php/mySQL question
- Started
- Last post
- 4 Responses
- frankosonik
I have a simple 'if' statement that needs to get a variable from the query string, then show the appropriate database recordset. Here's the code:
$myId = $_GET['id'];
if ($myId == "3") {
$row_Recordset1['page_tst'];
} else if ($myId == "2") {
$row_Recordset1['entry'];
} else {
$row_Recordset1['news'];
}I'm not getting any php error message, the data is just not appearing. There are other calls to the database on the page outside of this statement that are working, so I think my connection info is correct.
What am I missing?
Thanks.
- bcoden0
$row_Recordset1 is this your ecord set call? The srest of teh code would help out in troubble shooting this.
- tGP0
yeah...post some more code and we can help you better...
cheers
j
- frankosonik0
Here's how the database recordset is defined:
mysql_select_db($database_sample... $sample);
$query_Recordset1 = "SELECT id_number, page_ttl, entry, news, page_tst FROM sample_content WHERE id_number = 5";
$Recordset1 = mysql_query($query_Recordset1, $sample) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
- frankosonik0
sorry, I found the problem. I was missing an 'echo' in front of each recordset call in the if statement.
Thanks.