franknu Posted April 10, 2007 Share Posted April 10, 2007 can anyone help here i have this code that when the user type in his user_name and password will display the info so he can update it. my problem is that it is not selecting all the info except for the user name and password from the database help please [code=php:0] $Picture4 = (isset($_POST['Picture4']) ? $_POST['Picture4']:''); $User_Name = (isset($_POST['User_Name']) ? $_POST['User_Name']:''); $Password = (isset($_POST['Password']) ? $_POST['Password']: ''); $User_Name=strtolower($_POST['User_Name']); $Password=strtolower($_POST['Password']); $usercheck = mysql_query("SELECT * FROM business_info where User_Name='$User_Name' AND Password='$Password'",$db)or die(mysql_error()); $result = mysql_query($query) or die(mysql_error()); $userrow = mysql_fetch_array($usercheck); $num_rows = mysql_num_rows($usercheck); $query = "SELECT * FROM business_info where BusinessName='' AND User_Name='$User_Name' AND Password='$Password'"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { $BusinessName= $row['BusinessName']; $Keyword = $row['Keyword']; $Picture1 = $row['Picture1']; $Headline = $row['Headline']; $Slogan =$row['Slogan']; $Slogan2 = $row['Slogan2']; $Description1 =$row['Description1']; $Description2 = $row['Description2']; $Description3= $row['Description3']; $Contact2 = $row['Contact2']; $Picture2 = $row['Picture2']; $Picture3 = $row['Picture3']; $Categories=$row['Categories']; $Business_Address= $row['Business_Address']; $make=$row['make']; $type=$row['type']; $Tel= $row['Tel']; $Website=$row['Website']; } if ($num_rows == 0 || $num_rows > 1) { print "<p><b>username and/or password not found. Try again?</b></p>"; } else { echo" <table border='0'>"; echo"<tr>"; echo"<td valign='top'>"; echo"<table border='0'>"; echo"<tr>"; echo" <td bgcolor='cococo'>"; echo"<a href='index.php'>"; //100 echo"Home"; echo"<font color='cococo'>ddddddddddddddddddddd</font> </a>"; echo"</td></tr>"; echo"<tr>"; // new line echo "<pre>"; print_r($_POST); echo "</pre>"; echo "<td>welcome $BusinessName, "; echo"<font color='ffffff'>dddddddddddddddddddfffffffffffffffffffdd</font> </td>"; echo "</tr>"; echo" </table> <table background='../images/fondo2.jpg' border='1' valign='top'>"; echo"<tr>"; echo" <td valign='top'>"; echo "<table border='1'background='../images/fondo2.jpg' valign='top'>"; echo"<tr>"; echo" <td>"; echo" <a href= 'http://entrepreneur.com'>Pictures Uploads/change</a>"; echo" </td> </tr> <tr> <td>"; echo" <a href= 'http://entrepreneur.com'>Advertise your website</a>"; echo" </td> </tr><tr> <td></td></tr> <tr> <td>"; echo"<a href='http://69.89.27.201:2082/horde/index.php/'>Email</a> </td></tr> <tr> <td></td> </tr> <tr> <td>"; echo"<a href='http://www.nasdaq.com'>Stock Market</a></td>"; echo" </tr> </table> </td> <td valign='top'> <center><table border='1'> <tr>"; //145 echo"<td><a href=\'update.php?update=true\'>update</a></td>"; echo"<td><a href=\'keyword.php?keyword=true\'>Add Key words</a></td>"; echo"<td><a href='http://www.ccbill.com'>CCBILL</a></td> </tr></table> </center> "; $sql = "SELECT * FROM business_info WHERE BusinessName = '$BusinessName' AND User_Name = '$User_Name'"; $result = mysql_query($query) or die ("Problem with the query: <pre>$sql</pre><br>" . mysql_error()); $res2 = mysql_fetch_assoc($result); $query="UPDATE business_info SET BusinessName= '$BusinessName', `Slogan`=('$_POST[$Slogan]'), Business_Address = ('$_POST[business_Address]'), Tel=('$_POST[Tel]'), Website= ('$_POST[Website]'), Email = ('$_POST[Email]'), Fax= ('$_POST[Fax]'), `type`='$type', make = '$make', Categories = ('$_POST[Categories]'), Keyword = ('$_POST[Keyword]'), Picture1 = ('$_POST[Picture1]'), Headline = ('$_POST[Headline]'), Slogan2 = ('$_POST[slogan2]'), Description1 = ('$_POST[Description1]'), Description2 = ('$POST[Description2]'), Description3 = ('$_POST[Description3]'), Picture2 = ('$_POST[Picture2]'), Picture3 = ('$_POST[Picture3]'), `Password`= '$Password' WHERE User_Name = '$User_Name'"; $result = mysql_query($query) or die ("Problem with the query: <pre>$query</pre><br>" . mysql_error()); echo'<table bgcolor="ffffff">'; echo'<tr><td> <table><tr> </tr> </table> </td></tr><tr><td></td> </tr><tr><td> <table> <tr> <td><table bgcolor="ffffff"> <tr> <td> <table> '; //208 echo'<form action="'. $_SERVER['PHP_SELF'].'" method="post" enctype="multipart/form-data">'; echo'<tr>'; echo'<td> Busiess Info </td></tr><tr> <td> <table> <tr> <td> Business Name </td> <td>'; echo '<input type="text" name="BusinessName" value="' . stripslashes($_POST['BusinessName']) .'">'; echo '</td>'; echo'</tr> <tr> <td> Slogan </td> <td>'; echo'<input type="text" NAME="Slogan" value="'. stripslashes($_POST['Slogan']).'" >'; echo"</td> <td> Website </td> <td>"; echo'<input type="text" name="Website" value="' . stripslashes($_POST['Website']). '" >'; echo' </td>'; echo"</tr> <tr> <td> Tel </td> <td>"; echo'<input type="text" name="Tel" value="' . stripslashes ($_POST['Tel']). '" >'; echo"</td>"; echo"<td> Key Words </td> <td>"; echo'<input type="text" name="Keyword" value="' . stripslashes($_POST['Keyword']). '" >'; echo"</td> </tr> <tr> <td> Fax </td> <td>"; echo '<input type="text" name="Fax" value="' . stripslashes($_POST['Fax']). '">'; echo"</td> <td> Address </td> <td>"; echo '<input type="text" name="Business_Address" value="' . stripslashes($_POST['Business_Address']) .'">'; echo"</td> </tr></table> </td></tr><tr> <td><table><tr> <td> </td> <td> </td> <td></td><td> </td><td> Category</td><td>"; echo '<textarea rows="5" cols="65" name="Categories">' . stripslashes($_POST['Categories']) . '</textarea>'; [/code] Link to comment https://forums.phpfreaks.com/topic/46456-query-was-empty/ Share on other sites More sharing options...
kenrbnsn Posted April 10, 2007 Share Posted April 10, 2007 Please edit you post and replace the tags with . Ken Link to comment https://forums.phpfreaks.com/topic/46456-query-was-empty/#findComment-225986 Share on other sites More sharing options...
franknu Posted April 10, 2007 Author Share Posted April 10, 2007 i guess the problem is on select somewhere Link to comment https://forums.phpfreaks.com/topic/46456-query-was-empty/#findComment-226241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.