Log in

View Full Version : Need some more help please



captainjustin
03-02-2012, 07:33 AM
Can someone please show me what I'm doing wrong here.... Thanks in advance.... You guys Rock!


[PHP]<?php


include("conn.php");

//// Get items from url
$area1 = mysql_real_escape_string($_GET['area']);
$block_number1 = mysql_real_escape_string($_GET['block_number']);

// Set how wide you want your table
$tblWidth = 2;
// Make your query
$sql = mysql_query("select * from platform_location where block_number = \"$block_number\" and area = \"$area\"");
$i = 1;
echo '<table align=center width=100%>';
// Check to see if any results were returned
if(mysql_num_rows($sql) > 0){
echo '<tr>';
// Loop through the results
while($row = mysql_fetch_array($sql)){
echo '<td bgcolor=grey align=center><font color="ffffff"><b>'. $row['area'] .' '. $row['block_number'] .'</b></font><br>Structure Name: '. $row['structure_name'] .'<br>Latitude: '. $row['latitude'] .'<br>Longitude: '. $row['longitude'] .'<br>Attended: '. $row['attended'] .'
<br><a href="platform_info.php?p_id='. $row['p_id'] .'" target="_self"><img src="Aqua-Screensaver-icon.png" width="64" height="64" border="0" alt="Click For More Information" /></a><br></td>';
if($i == $tblWidth){
echo '</tr><tr>';
$i = 0;
}
$i++;
}
echo '</tr>';
}else{
echo '<tr><td><br>You Must Select A Block Number!</td></tr>';
}
echo '</table>';


?>[/code]

traq
03-02-2012, 09:37 PM
Can someone please show me what I'm doing wrong here....

A very broad question... :)

You have mismatched BBCode tags (
... [/code] should be [php] ... )

You are mixing logic with output (it's better to have the script do all of the work first, assigning the result to a variable, and then print everything to the browser at once)

You're using the mysql_*() functions -- if you're using MySQL greater than version 4.1 (hint: you almost certainly are), you should be using to mysqli_*() (or PDO, etc.) functions instead

If your question is actually about something specific, please be more specific, and we'd be happy to give a more specific answer.Your question is unclear.
Please provide more information, and be as specific as possible.
What do you want to accomplish? What have you already tried? What problems did you encounter?
Also, please be sure that you have included all relevant code and/or a link to the page in question.