Jump to content

eMonk

Members
  • Posts

    223
  • Joined

  • Last visited

Everything posted by eMonk

  1. Ah, I have it working now. Just moved this query after a different one. Thanks for the help everyone!
  2. Ok, I have it working now... $city_2 = $row3['city_display']; should have been $city_2 = $row3['city_id']; however now when i echo $city_2 at the bottom of the page, the value isn't displaying correctly like before. I'm not overwriting the $city_2 variable anywhere. Why is this variable loosing it's value at the bottom of the page?
  3. $qP3 = "SELECT * FROM model_in_city WHERE city_display = 2 AND model_id = '$id' "; $rsP3 = mysql_query($qP3); $row3 = mysql_fetch_assoc($rsP3); $city_2 = $row3['city_display'];
  4. I tried that before fugix but it didn't work. Any more ideas? Added the ; on the last line as well.
  5. See anything wrong with this code? $city_1 and $city_2 still aren't showing up in text fields but the data shows correctly in phpmyadmin. $id = $_GET['id']; $qP2 = "SELECT * FROM model_in_city WHERE city_display = 1 AND model_id = '$id' "; $rsP2 = mysql_query($qP2); $row2 = mysql_fetch_array($rsP2); extract($row2); $city_1 = trim($city_display); $qP3 = "SELECT * FROM model_in_city WHERE city_display = 2 AND model_id = '$id' "; $rsP3 = mysql_query($qP3); $row3 = mysql_fetch_array($rsP3); extract($row3); $city_2 = trim($city_display);
  6. Would this be the correct if sytnax? if ($rsUpdate1, $rsUpdate2, $rsUpdate3) { echo "Update successful."; }
  7. The following code works but wondering if I should be using $update1, $update2, $rsUpdate1, $rsUpdate2 instead for error checking etc. $update = "UPDATE model SET name = '$name', age = '$age', ... "; $rsUpdate = mysql_query($update); if( isset($city_1) ) { $update = "UPDATE model_in_city SET city_id = '$city_1', ...'"; $rsUpdate = mysql_query($update); } if( isset($city_2) ) { $update = "UPDATE model_in_city SET city_id = '$city_2', ...'"; $rsUpdate = mysql_query($update); } if ($rsUpdate) // insert $rsUpdate2 && $rsUpdate3 here as well? { echo "Update successful."; }
  8. I was about to post that I just realized that I have to extract the data now but too tired now to play with it. Will continue this tomorrow and write a follow up. Thanks!
  9. Right now I'm trying: $id = $_GET['id']; $city_1 = mysql_query("SELECT * FROM model_in_city WHERE city_display = 1 AND model_id = '$id' "); $city_2 = mysql_query("SELECT * FROM model_in_city WHERE city_display = 2 AND model_id = '$id' "); but it's not displaying the correct value in the following text field: <tr> <td>City 1</td> <td><input name="city_1" type="text" size="2" value="<?=$city_1?>" maxlength="2"></td> </tr> However, PHPMYADMIN is showing the correct value. Any ideas?
  10. Can you add a WHERE clause in $row? For example: $row['city_display'] WHERE city_display = 1 $row['city_display'] WHERE city_display = 2 etc... How can this be done?
  11. Ah, I understand now... 2 different connect types. I guess that's what I get for looking at someone else's connect.php file. I'll stick with mysqli, thanks mgoodman!
  12. Just tried: $query = "select url, thumbnail, name, location from model order by name asc"; $result = mysql_query($query); But get this error: Fatal error: Call to a member function free() on a non-object
  13. Also tried this: $query = "select url, thumbnail, name, location from model order by name asc"; $result = mysql_query('select url, thumbnail, name, location from model order by name asc'); But it doesn't look right...
  14. It didn't work... $connection = mysqli("$hostname" , "$user" , "$pass") Fatal error: Call to undefined function mysqli()
  15. mgoodman, what do you mean? How and where do I do this? $result = mysql_query('SELECT * FROM table'); // is this how??
  16. I'm trying to replace the mysqli code so I can include connect.php like on my other pages. Complete connect.php code: <?php $hostname='localhost'; $user='username'; $pass='password'; $dbase='database'; $connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL"); $db = mysql_select_db($dbase , $connection) or die ("Can't select database."); ?> Here's how I'm trying to include it: <?php include("connect.php"); $query = "select url, thumbnail, name, location from model order by name asc"; $result = $db->query($query); $num_results = $result->num_rows; echo "<p>Number of models found: ".$num_results."</p>"; for ($i=0; $i <$num_results; $i++) { $row = $result->fetch_assoc(); echo "<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">" ; echo "<tr>" ; echo "<td width=\"50\"><a href=\"" . $row["url"] . "\"><img src=\"" . $row["thumbnail"] . "\" border=\"0\" width=\"60\" height=\"60\"></a></td>" ; echo "<td valign=\"top\"><a href=\"" . $row["url"] . "\">" . stripslashes($row['name']) . "</a><br />short desc<br />(" . stripslashes($row['location']) . ")</td>" ; echo "</tr>" ; echo "<tr>" ; echo "<td colspan=\"2\"><hr /></td>" ; echo "</tr>" ; echo "</table>" ; } $result->free(); $db->close(); ?>
  17. You can use: SELECT * FROM Teachers WHERE member_id = 1 SELECT * FROM Teachers WHERE member_id = 2 etc...
  18. The following code works: @ $db = new mysqli('localhost', 'username', 'password', 'database'); if (mysqli_connect_errno()) { echo 'Error: Could not connect to database. Please try again later.'; exit; } $query = "select * from model order by name asc"; $result = $db->query($query); However, I just started to include connect.php to my pages. Now I'm getting an error saying: "Fatal error: Call to a member function query() on a non-object on line 14" Here's my connect.php .... $db = mysql_select_db($dbase , $connection) or die ("Can't select database."); Line 14 is... $result = $db->query($query); Any ideas? I believe it's the $db variable causing the problem.
  19. eMonk

    background

    I'm not sure what you mean, there is no fixed height. Do you have any samples of the height you're talking about?
  20. eMonk

    background

    I figured it out... just made #content have a left and right border instead of side a and b.
  21. eMonk

    background

    The problem is when content gets added to side-a... the other side doesn't move down with it... there is no fixed height... side-a will be fetching a list of cities from a mysql database, reason why there is no fixed height, each page will have a different amount of cities being displayed. Is there anyway to make the line of side-b move down with side-a as content gets added?
  22. eMonk

    background

    Is it possible to extend the blue line on side-b to the bottom without having to use a repeating background image with these 2 blue lines? I tried height=100% in the css file but it's not what I'm looking for (it makes the height 100% of the screen instead of matching the blue line on side-a). Here's the css code: #wrapper { text-align: left; margin: 0px auto; padding: 0px; border:0; width: 780px; /* background: url("images/background.gif") repeat; */ } #side-a { float: left; width: 134px; border-right-style: solid; border-right-width: 1px; border-right-color: #009BD7; padding: 5px; } #side-b { float: right; width: 134px; border-left-style: solid; border-left-width: 1px; border-left-color: #009BD7; padding: 5px; } #content { float: left; width: 480px; padding: 5px; }
  23. I just removed $_SERVER['SERVER_NAME'] and it appears to be working now. Thanks for the help everyone!
  24. The name of the province, for example, British Columbia.
  25. BTW the output should be: http://www.domain.com/v1/british-columbia.php
×
×
  • 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.