Jump to content

franknu

Members
  • Posts

    344
  • Joined

  • Last visited

    Never

Everything posted by franknu

  1. now i am getting something with more sense, I am displaying 3 rows which it is what i have but not values and this is what i have $sql="SELECT business_info.* FROM business_info,messages WHERE business_info.BusinessName=messages.BusinessName and messages.BusinessName='".$_SESSION['BusinessName']."' "; $result=mysql_query($sql); while($row=mysql_fetch_assoc($result)) { $date = $row['date']; $from = $row['from']; $status = $row['status']; $subject = $row['subject']; $message =$row['message']; echo"<tr>"; echo" <td>"; echo' <input type="checkbox" name="checkbox" value="checkbox"></td>'; echo" <td> $date </td>"; echo" <td> $from </td> "; echo"<td> $status </td>"; echo"<td><a href='message_display'> $subject </a></td>"; echo"</tr>"; } ?>
  2. ok, i fixed the error but i am displaying the same values 27 times then another that match but and repeats another 27 times $sql="SELECT messages.* FROM business_info,messages WHERE business_info.BusinessName=messages.BusinessName"; $result=mysql_query($sql); while($row=mysql_fetch_assoc($result)) { $date = $row['date']; $from = $row['from']; $status = $row['status']; $subject = $row['subject']; $message =$row['message']; echo"<tr>"; echo" <td>"; echo' <input type="checkbox" name="checkbox" value="checkbox"></td>'; echo" <td> $date </td>"; echo" <td> $from </td> "; echo"<td> $status </td>"; echo"<td><a href='message_display'> $subject </a></td>"; echo"</tr>"; } ?>
  3. i get an error message Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
  4. yes that is the one that u help me with yesterday; i did var_dump($row); and display all the values too, i need more than one values, i just dont want the values to repeat for no apprent reason
  5. Ok i am tryin to get a value to display from my database my problem is that it is repeating like 20 times when i only have one row that match that value but then same value keep displaying like 20 times please help <? $sql=" SELECT messages.* FROM business_info,messages WHERE business_info.BusinessName=messages.BusinessName"; $result=mysql_query($sql); while($row=mysql_fetch_assoc($result)) { $date = $row['date']; $from = $row['from']; $status = $row['status']; $subject = $row['subject']; $message =$row['message']; echo"<tr>"; echo" <td>"; echo' <input type="checkbox" name="checkbox" value="checkbox"></td>'; echo" <td> $date </td>"; echo" <td> $from </td> "; echo"<td> $status </td>"; echo"<td><a href='message_display'> $subject </a></td>"; echo"</tr>"; } ?>
  6. please help, i dont see what the problem is
  7. well, my problem now is that it is showing like 20 rows the sameway meaning, repeating itself <? $sql=" SELECT messages.* FROM business_info,messages WHERE business_info.BusinessName=messages.BusinessName"; $result=mysql_query($sql); while($row=mysql_fetch_assoc($result)) { $BusinessName= $row['BusinessName']; $date = $row['date']; $from = $row['from']; $status = $row['status']; $subject = $row['subject']; $message =$row['message']; echo"<tr>"; echo" <td>"; echo' <input type="checkbox" name="checkbox" value="checkbox"></td>'; echo" <td> $date </td>"; echo" <td> $from </td> "; echo"<td> $status </td>"; echo"<td> $subject </td>"; echo"</tr>"; } ?>
  8. ok this is really what is relevant the tables and stuff would only make look long . and if i put it inside he while loop, how would the table look wouldnt it look messy here is my code more simpler <? $sql=" SELECT messages.* FROM business_info,messages WHERE business_info.BusinessName=messages.BusinessName"; $result=mysql_query($sql); while($row=mysql_fetch_assoc($result)) { $BusinessName= $row['BusinessName']; $date = $row['date']; $from = $row['from']; $status = $row['status']; $subject = $row['subject']; $message =$row['message']; } ?> <input type="checkbox" name="checkbox" value="checkbox"></td> <td><? echo"$date"; ?></td> <td><? echo"$from"; ?></td> <td><? echo"$status"; ?></td> <td><? echo"$subject"; ?></td> // this one i also want to make it a link <tr>
  9. well, this is my sql code which work fine <? $sql=" SELECT messages.* FROM business_info,messages WHERE business_info.BusinessName=messages.BusinessName"; $result=mysql_query($sql); while($row=mysql_fetch_assoc($result)) { $BusinessName= $row['BusinessName']; $date = $row['date']; $from = $row['from']; $status = $row['status']; $subject = $row['subject']; $message =$row['message']; } ?> i know it has to do with the way i am pulling the info
  10. ok, I want to display all the values from a colum that matches. Right now i am only displaying the the last value that was inserted in know it has to do with $row['value'] but i am not displaying anything when i do it that way so here is my current code here is my code </tr> <td><input type="checkbox" name="checkbox" value="checkbox"></td> <td><? echo"$date"; ?></td> <td><? echo"$from"; ?></td> <td><? echo"$status"; ?></td> <td><? echo"$subject"; ?></td> <tr>
  11. ok that is displaying this now Fatal error: Call to undefined function: mysql_fetc_assoc()
  12. that didnt work Here is my code <? $sql=" SELECT messages.* FROM business_info,messages WHERE business_info.BusinessName=messages.BusinessName"; mysql_query($sql) or die(mysql_error()); $result=mysql_query($sql); if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $BusinessName= $row['BusinessName']; $date = $row['date']; $from = $row['from']; $subject = $row['subject']; $message =$row['message']; } else { echo "Query failed<br />$sql<br />". mysql_error(); exit; } } ?>
  13. they do have the same value, and column name and now it sounds like now i need to pick one table i want to select messages table
  14. well i deleted this AND BusinessName= '".$_SESSION['BusinessName']." from the end but then it is not selecting from the database
  15. ok, i am getting this now never seen it before Column 'BusinessName' in where clause is ambiguous
  16. Ok, i made some changes and here is my new code if( isset($BusinessName)) { $sql=" SELECT * business_info.BusinessName, messages.BusinessName FROM business_info,messages WHERE business_info.BusinessName=messages.BusinessName AND BusinessName= '".$_SESSION['BusinessName']."' "; mysql_query($sql) or die(mysql_error()); $result=mysql_query($sql); } here is my display error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'business_info.BusinessName, messages.BusinessName FROM business_info,messages W' at line 1
  17. ok i am getting a syntax error on my query here it is You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'business_info.BusinessName, messages.BusinessName FROM busines_info INNER JOIN m' at line 1 and here is my code <? if( isset($BusinessName)) { $sql= "SELECT * business_info.BusinessName, messages.BusinessName FROM busines_info INNER JOIN messages WHERE BusinessName= '".$_SESSION['BusinessName']."' "; mysql_query($sql) or die(mysql_error()); $result=mysql_query($sql); } if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $BusinessName= $row['BusinessName']; $date = $row['date']; $from = $row['from']; $subject = $row['subject']; $message =$row['message']; } else { echo "Query failed<br />$sql<br />". mysql_error(); exit; } } ?>
  18. ok i made some changes and some error display here is my new code i am still not getting anything <? if( isset($_SESSION['BusinessName'])) { $sql= "SELECT * FROM messages WHERE $BusinessName='".$_SESSION['BusinessName']."' "; mysql_query($sql) or die(mysql_error()); $result=mysql_query($sql); } if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $BusinessName= $row['BusinessName']; $date = $row['date']; $from = $row['from']; $subject = $row['subject']; $message =$row['message']; } else { echo "Query failed<br />$sql<br />". mysql_error(); exit; } } ?>
  19. I made some changes to the code maybe i was going to get something diffrent and still, i didnt get anything here is my code <? if( isset($_SESSION['BusinessName'])) { $sql= "SELECT * FROM messages WHERE $BusinessName='".$_SESSION['BusinessName']."' "; $result=mysql_query($sql); } if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $BusinessName= $row['BusinessName']; $date = $row['date']; $from = $row['from']; $subject = $row['subject']; $message =$row['message']; } } ?>
  20. Ok, i have tow diffrent tables and i want to display the values for table name message that match the value for colum BusinessName on table name business_info and message i have two query the first one works but the second one is not dispalying values here is my code <?php session_start(); $_SESSION['User_Name']; $_SESSION['Password']; $_SESSION['BusinessName']; ?> <html> <head> <body> <? if ( isset($_SESSION['User_Name']) && isset ($_SESSION['Password']) ) { $query = "SELECT * FROM business_info where User_Name='".$_SESSION['User_Name']."' AND Password='".$_SESSION['Password']."'" ; $result=mysql_query($query); } if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { $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']; } else { echo "<p><b>username and/or password not found. Try again? </b></p>"; exit; } } else { echo "Query failed<br />$query<br />". mysql_error(); exit; } ?> <table width="504" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC"> <tr> <td width="494"> <table width="497" border="0" bgcolor="#FFFFFF"> <tr> <td width="487">Banner</td> </tr> <tr> <td background="fondo2.jpg"> <? echo " Welcome <b>$BusinessName </b>"; $_SESSION['User_Name']; $_SESSION['Password']; $_SESSION['BusinessName']; ?> <? // This is the query that is not displaying any values any idea how i should fix this if($BusinessName=$_SESSION['BusinessName']) { $sql= "SELECT * FROM messages WHERE $BusinessName='".$_SESSION['BusinessName']."' "; $result=mysql_query($sql); } if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $BusinessName= $row['BusinessName']; $date = $row['date']; $from = $row['from']; $subject = $row['subject']; $message =$row['message']; } } ?> <tr> <td><input type="checkbox" name="checkbox" value="checkbox"></td> <td> </td> <td><? echo"$date"; ?></td> <td>gg</td> <td><? echo"$subject"; ?></td> </tr> ?>
  21. ok here is my full code for page2 <?php session_start(); $_SESSION['BusinessName']; ?> <html> <head> <title>Send Message</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#E5E5E5"> <?php $db = mysql_connect($host, $username, $password) or die(mysql_error()); mysql_select_db($database) or die(mysql_error()); $from = addslashes($_POST['from']); $status= addslashes($_POST['status']); $subject= addslashes($_POST['subject']); $message= addslashes($_POST['message']); $BusinessName= $_SESSION['BusinessName']; if(isset($_SESSION['BusinessName'])){ $query = "INSERT INTO `messages` (`BusinessName`,`date`,`from`,`status`,`subject`,`message`) VALUES ('".$_SESSION['BusinessName']."','".$date."','".$from."', '".$status."','".$subject."', '".$message."')"; $result = mysql_query($query); echo mysql_error(); if($result) { echo mysql_affected_rows()." .Your Message have been sent. We will get back to you. <br>"; } } ?> <center> <pre>_SESSION:<?php print_r($_SESSION); ?></pre> <table width="200" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td valign="top"> <?php include("includefiles/banner.php"); ?> <table width="778" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="778" valign="top"> <table width="778" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top" bgcolor="#f90102"> <?php echo "<h1><font color='ffffff'><marquee>$BusinessName </marquee></font></h1>"; ?> </td> </tr> </table></td>
  22. $_SESSION['BusinessName'] =$BusinessName; i under the session $BusinessName = (isset($_GET['BusinessName']) ? $_GET['BusinessName'] : ''); $Slogan = (isset($_GET['Slogan']) ? $_GET['Slogan']:''); $Business_Address = (isset($_GET['Business_Address']) ? which is where i am assigning a value, i just added the part of the codes where the problem might be also i think that the main problem is on page2 because i can display the value of $_SESSION['BusinessName'] ='$BusinessName'; on page1
  23. Ok, I looks like i am destroying the session BusinessName on page 2 so my problem is on page two with the variable BusinessName
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.