BluwAngel Posted March 7, 2012 Share Posted March 7, 2012 Warning: mysql_fetch_array() expects parameter 1 to be resource, string given... im tryin to put class inside code if $dayNumber and $dan are equal i tried few ways but all are complicated since i have to call some functions this end up as "simple" solution but i dont know where did i get wrong PS that should be possible? else { echo "<td width='40'"; $moj_id = $_SESSION['id']; $query_event = mysql_query("SELECT * FROM events WHERE id_user='$moj_id' GROUP BY 'event_date'") ; $test = mysql_fetch_array('$query_event'); $date_event = $test['event_date']; sscanf($date_event, "%d-%d-%d", $godina, $mjesec, $dan); if ($dan==$dayNumber && $mjesec==$month && godina==$year) { echo " class='radni'"; } echo"><a href='day_info.php?dan=",$dayNumber,"&mj=",$month,"&gd=",$year,"'>" . $dayNumber . " </a></td>\n"; $dayNumber++; } Quote Link to comment https://forums.phpfreaks.com/topic/258494-fail-experiment-mysql-fetch-array/ Share on other sites More sharing options...
marcus Posted March 7, 2012 Share Posted March 7, 2012 $test = mysql_fetch_array($query_event); You literally just have to remove the quotes. The quotes turns the query into a string. Quote Link to comment https://forums.phpfreaks.com/topic/258494-fail-experiment-mysql-fetch-array/#findComment-1325012 Share on other sites More sharing options...
BluwAngel Posted March 7, 2012 Author Share Posted March 7, 2012 it did solve my problem, but it still gets only 1 result - its calendar, it generate numbers(days) ok, but somehow it fails to put that class on field i want to on event_date i have dates 28.03.2012 30.03.2012 and it only put at 30.03.2012. Quote Link to comment https://forums.phpfreaks.com/topic/258494-fail-experiment-mysql-fetch-array/#findComment-1325016 Share on other sites More sharing options...
marcus Posted March 8, 2012 Share Posted March 8, 2012 You have to loop through it. while($test = mysql_fetch_array($query_event){ // code here } Quote Link to comment https://forums.phpfreaks.com/topic/258494-fail-experiment-mysql-fetch-array/#findComment-1325025 Share on other sites More sharing options...
BluwAngel Posted March 8, 2012 Author Share Posted March 8, 2012 oh i erased that and totaly forgot about it... thanks, solved Quote Link to comment https://forums.phpfreaks.com/topic/258494-fail-experiment-mysql-fetch-array/#findComment-1325029 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.