mysql problem

db , mysql , php Egypt
  • 13 years ago
    i have a problem, that i want to match two tables in database called post jobs and user2 which models employees CVs ; i want to match between the two tables in order to filter CVs and choose at end qualified applicants in online employment system.

    <?php
    include 'connect.php';
    $kk=$session['user'];
    //$query = "SELECT user2.cpos, postjobs.post "."FROM user2, postjobs ".
    //    "WHERE postjobs.jcat = user2.jcat";
    $query = "SELECT count(user2.Id) FROM (SELECT * "FROM user2, postjobs" . "WHERE postjobs.jcat = user2.jcat");
         
    $result = mysql_query($query) or die(mysql_error());


    // Print out the contents of each row into a table
    while($row = mysql_fetch_array($result)){
        //echo $row['post']." - ". $row['cpos'];
        echo $row['count(user2.Id)'];
        echo "<br />";
    }
    ?>



















  • 13 years ago
    what kind of error were you getting.....

    looks like the mysql syntax isn't quite right....
    if this is the case, echo the query, and try it in mysql query browser (of whatever you have) and see what the error is...




  • 13 years ago
    Toss a var_dump($row) into the while loop and comment out the second echo.  That might give you a point in the right direction.  I think you may have meant mysql_fetch_assoc instead of mysql_fetch_array.  You're going to have to be more specific on the problem, though. 

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan