$sql = "SELECT * FROM schedule ".
                           "WHERE CurriID ON (SELECT CurriID FROM curriculum ".
                           "WHERE (Pre_Requisite LIKE (SELECT CONCAT('%',SubjCode) ".
                           "FROM studgrade WHERE (Grade >=1 and Grade <=3) AND StudentNumber='$id') ".
                           "AND Pre_Requisite LIKE (SELECT CONCAT(SubjCode,'%') FROM studgrade WHERE ".
                           "(Grade !='5' and Grade !='INC') AND StudentNumber='$id')) OR Pre_Requisite ON ".
                           "(SELECT SubjCode FROM studgrade WHERE (Grade !='5' AND Grade !='INC') AND StudentNumber='$id')";

I just try to view all the subject that available in the schedule of the subject which is base on the subject that they passed. I used the CONCAT function in query for joining the string of '%' and subjCode. but the result is ..

mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\insertion\outputschedule.php on line 18

Can anyone help me some tips in using CONCAT??

Recommended Answers

All 2 Replies

In Line 6 of the query, I think you've to use IN, not ON

Member Avatar for Dukane

That error message means that the result is not returned from the database. Typically, if you have bad SQL the error message will tell you about syntax of the query. Can you show us a little more code? Are you calling mysql_query()?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.