DarkWater Posted May 12, 2008 Share Posted May 12, 2008 Skittalz, no offense, but please stop giving him bad advice. =X while($r=mysql_fetch_array($result)) is how it should be done. Now, rockin, please show me the output of this query in the MySQL client just so I can look at the example values: SELECT d.*, k.*, e.* FROM employees as e, departments as d, emp_keys as k LIMIT 1 \G Just put that query in and show me the entire output. Thanks. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539401 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 that syntax gives me a an syntax error in my mysql client Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539409 Share on other sites More sharing options...
DarkWater Posted May 12, 2008 Share Posted May 12, 2008 Copy and paste it in....It gives me no syntax errors. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539417 Share on other sites More sharing options...
revraz Posted May 12, 2008 Share Posted May 12, 2008 When you receive an error, you should copy and paste it here so people that help you can continue to help you. that syntax gives me a an syntax error in my mysql client Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539421 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 how can i add a image Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539424 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 i dont know how to copy to and from cmd prompt Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539428 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539430 Share on other sites More sharing options...
DarkWater Posted May 12, 2008 Share Posted May 12, 2008 Take a screenshot. Press the PrtScrn button (above Insert) and then press Paste while in Paint. Save it and attach it to a post. =P Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539431 Share on other sites More sharing options...
revraz Posted May 12, 2008 Share Posted May 12, 2008 Any text on the Browser can be highlighted, copied and pasted. You don't need a Image. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539435 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 it doesnt give me an error did the copy/paste but how can i copy cmd prompt Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539437 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 mysql> SELECT d.*, k.*, e.* FROM employees as e, departments as d, emp_keys as k LIMIT 1 \G; *************************** 1. row *************************** dept_id: 1 dept: City Manager's phone: 383-1800 k_id: 1 emp_id: 1 key_num: 3456 accss: data room, office emp_id: 1 dept_id: 1 Fname: Danny Lname: Vera email: [email protected] 1 row in set (0.00 sec) ERROR: No query specified mysql> Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539443 Share on other sites More sharing options...
revraz Posted May 12, 2008 Share Posted May 12, 2008 I'm confused on why you are at the cmd prompt doing PHP code. Or do you mean you are using a SQL command line? *Ok, looks like it did return 1 row. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539445 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 sql line on my cmd prompt i have posted the output of the sql syntax that dark told me to run. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539446 Share on other sites More sharing options...
DarkWater Posted May 12, 2008 Share Posted May 12, 2008 Yes, he is, Revraz. =/ Anyway, try this in your PHP code as your SELECT: SELECT e.*, k.*, d.dept FROM employees as e, emp_keys as k, departments as d WHERE e.emp_id = k.emp_id AND d.k_id = k.k_id Should work. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539448 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 nope doesn't display anything Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539449 Share on other sites More sharing options...
revraz Posted May 12, 2008 Share Posted May 12, 2008 Post the updated code. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539451 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 nothing no output. i think i'm just going to give up and trash this project. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539452 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 <table width="100%" border="0" cellspacing="0" cellpadding="1"><form method="post" action="searchemps.php"> <tr> <td colspan="4"><font style="font-size:12px; color: #000000">Type in name of employee to search:</font></td> </tr> <tr> <td width="22%"><font style="font-size:12px; color:#000000">First Name: </font></td> <td width="29%"><input type="text" name="search" size=15 maxlength=25></td> <td width="21%"><font style="font-size:12px; color:#000000">Last Name:</font></td> <td width="28%"><input type="text" name="search2" size=15 maxlength=25></td> </tr> <tr> <td colspan="2"><input type="Submit" name="Submit" value=" " style="background:url(images/searchbutton.png) no-repeat center; height:35px; width:70px; border:0px; cursor:pointer" /> </form></td> <td colspan="2"><form method="post" action="allKeys.php"> <input type="submit" name="vall" value=" " style="background:url(images/viewallbutton.png) no-repeat center; height:35px; width:70px; border: 0px; cursor: pointer" /> </form> </td> </tr> </table> </div> <div class="p" style="clear:both"> <div align="center"> <?php if(!($db = @ mysql_connect('server', 'username', 'password'))) { echo 'Error: Could not connect to our database sorry for any inconvience.<br /> Please try at a later time.'; exit; } //select which database you want to edit mysql_select_db("db name); $vall=$_POST["vall"]; if(!isset($vall) || empty($vall)) { print"<p>No employees in Database."; } else{ $emp_id=$_GET["emp_id"]; //get the mysql and store them in $result //change whatevertable to the mysql table you're using //change whatevercolumn to the column in the table you want to search $query = "SELECT e.*, k.*, d.dept FROM employees as e, emp_keys as k, departments as d WHERE e.emp_id = k.emp_id AND d.k_id = k.k_id"; $result = mysql_query($query); //grab all the content while($r=mysql_fetch_array($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $dept=$r["dept"]; $asscc=$r["accss"]; $Fname=$r["Fname"]; $Lname=$r["Lname"]; $email=$r["email"]; $key_num=$r["key_num"]; $emp_id=$r["emp_id"]; ?> <table width="100%" border="0" cellpadding="1" cellspacing="0" class="table1"> <tr> <td width="14%"><font face="Arial, Helvetica, sans-serif"><?php print $dept; ?></font></td> <td width="17%"><font face="Arial, Helvetica, sans-serif" style="color:#CC6600"><?php print $Fname." ".$Lname; ?></font></td> <td width="28%"><font face="Arial, Helvetica, sans-serif"><?php print $email; ?></font></td> <td width="10%"><font face="Arial, Helvetica, sans-serif"><?php print $key_num; ?></font></td> <td width="50%"><font face="Arial, Helvetica, sans-serif"><?php print $asscc; ?></font></td> <td width="50%"> <?php print"<a href='delete.php?emp_id={$emp_id['emp_id']}'>Remove</a><br />";?> </td> </tr> </table> <?php }//end while loop } ?> Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539461 Share on other sites More sharing options...
rockindano30 Posted May 12, 2008 Author Share Posted May 12, 2008 well thank you darkwater and others for your help. but this one is a dead project as of may 12, 2008 4:06 Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539463 Share on other sites More sharing options...
revraz Posted May 12, 2008 Share Posted May 12, 2008 Man you give up fast. Oh well, cya. Link to comment https://forums.phpfreaks.com/topic/105319-solved-im-stuck-please-help/page/2/#findComment-539467 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.