Celcius Posted March 31, 2010 Share Posted March 31, 2010 I need to create a view though a PHP execution. Here is my code, the views are not being created, and thus my while($row = mysql_fetch_array($result)) is giving me this error. "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in ..." I have checked my MySQL queries and they seem to be in working order when directly executed. if($going == "1") { echo "ENTERING INCOMING"; $sql = mysql_query("CREATE VIEW inRangeIncoming AS SELECT f.flightNum, f.source, f.destination, i.actDate, i.plannedTime, i.actualTime FROM joinedIncoming i, flights f WHERE (i.plannedTime BETWEEN \'$timeStart\' AND \'$timeEnd\') AND (i.actDate = \'2010-03-31\') AND (f.flightNum = i.flightNum)"); $result = mysql_query("SELECT * FROM inRangeIncoming"); } elseif($going == "2") { echo "ENTERING OUTGOING"; $sql = mysql_query("CREATE VIEW inRangeOutgoing AS SELECT f.flightNum, f.source, f.destination, i.actDate, i.plannedTime, i.actualTime FROM joinedOutgoing o, flights f WHERE (i.plannedTime BETWEEN \'$timeStart\' AND \'$timeEnd\') AND (o.actDate = \'2010-03-31\') AND (f.flightNum = o.flightNum)"); $result = mysql_query("SELECT * FROM inRangeOutgoing"); } Link to comment https://forums.phpfreaks.com/topic/197069-php-with-mysql-creating-views/ Share on other sites More sharing options...
gizmola Posted March 31, 2010 Share Posted March 31, 2010 The code you have provided never calls mysql_fetch_array(). That warning is related to some other section of code. Link to comment https://forums.phpfreaks.com/topic/197069-php-with-mysql-creating-views/#findComment-1034488 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.