Jump to content
Larry Ullman's Book Forums

phirux

Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About phirux

  • Rank
    Newbie
  1. I've done following changes to code and it's now working correctly: function hae_sarake($parent, $dbc){ $sql = "SELECT `suo_kat` FROM `kategoria` WHERE `parent` = '$parent' ORDER BY `suo_kat` ASC"; Thanks for your time.
  2. I've got the following error message: Unknown column '$parent' in 'where clause'mysqli Object ( [affected_rows] => -1 [client_info] => mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $ [client_version] => 50010 [connect_errno] => 0 [connect_error] => [errno] => 1054 [error] => Unknown column '$parent' in 'where clause' [error_list] => Array ( [0] => Array ( [errno] => 1054 [sqlstate] => 42S22 [error] => Unknown column '$parent' in 'where clause' ) ) [field_count] => 0 [host_info] => Localhost via UNIX socket [info] => [
  3. The error message i've got as following: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''kategoria' WHERE 'parent' = '1' ORDER BY 'suo_kat' ASC' at line 1
  4. Thanks for your attention Larry. I've done following changes to my code to confirm that function has access to database. But nothing happened! function hae_sarake($dbc,$parent){ include ('mysqli_connect_0.php'); $sql = "SELECT 'suo_kat' FROM 'kategoria' WHERE 'parent' = '$parent' ORDER BY 'suo_kat' ASC"; $r = mysqli_query($dbc, $sql); if (!$r) { echo "Try again later!" . mysqli_error($dbc); } else { while($row = mysqli_fetch_assoc($r)){ for ($i=0; $i < mysqli_num_rows($r); $i++) { echo '<a class="teksti" href="">' . $row['suo_kat'][$i] . '</a><br />'; } } } }
  5. Hi Larry. There is no any problem to get connection to database. I used mysqli_error($dbc) and print_r($dbc) to find out if there’s any error, but didn’t get any message. I expect that this function retrieve from database all items which parent value is $parent and show tehm all as a list. If I use a simple code to get connection to database for printing all these items of fields which has same parent value, it will succeed: $sql = "SELECT 'suo_kat' FROM 'kategoria' WHERE 'parent' = '$parent' ORDER BY 'suo_kat' ASC"; $r = mysqli_query($dbc, $sql); if (!$r) { echo "Sorry. Try again
  6. Hi Larry! I'm trying to print all sub-category items using my own defined PHP function. There is some thing wrong with this function. Could you please help me to find out the reason why this function doesn’t work. Thanks a lot in advance. <?php include ('connect.php'); include ('head.html'); echo '<div class="categ"><p class="b">Health</p>'; function retrieve_column($parent){ $sql = "SELECT item FROM category WHERE parent = $parent ORDER BY item ASC"; $r = mysqli_query($dbc, $sql); if (!$r) { echo "Couldn’t make a connection to
×
×
  • Create New...