Forum Moderators: coopster
While I am new to WW, I am not new to PHP/MYSQL. So, you can be as advanced in your speaking as you want to be and I will try my best to interpret :)
My current issue is with a SELECT query. Here is the code:
----------------------------------------------------------------------------------------------
$query = "SELECT phpfox_conference.conference_name, vault_sessions.title FROM vault_sessions
LEFT JOIN phpfox_conference ON (phpfox_conference.id = vault_sessions.conference)
WHERE vault_sessions.id=$session_id AND vault_sessions.conference=$es_event";
$title = current(getDataRow($query)) or die(mysql_error());
----------------------------------------------------------------------------------------------
The 'getDataRow' function is constructed on a different page. Here is the code for that function:
------------------------------------------------
function getDataRow($query){
$result = mysql_query($query);
$data = array();
while($row = mysql_fetch_row($result))
$data[] = $row;
return $data;
}
-------------------------------------------------
I am using the current function to step into the array and just grab the first result as that is all I need because I am in a FOR loop.
Now what is happening is this:
When the second WHERE condition is added to the query, "AND vault_sessions.conference=$es_event", the query fails to work and does not display an error or anything. Just no data is returned (I am doing a print_r on $title after the query is executed). However, when that second WHERE condition is taken out, the query works just fine.
Anyone have any other ideas about how to troubleshoot the issue or have an idea about what is wrong with my syntax or something of that sort?
Thanks for your time and I look forward to your responses.
------------------------
Returns precisely what it should with that query.