Jump to content

MySQL Query Not Working


jbwebdesign

Recommended Posts

Hello, I am having a problem pulling a record from mysql.....this is very strange to me and i don't understand why there is nothing being returned.

 

can someone please tell me if i am doing something wrong?

 

This code doesn't even return an error, it just doesn't work!

 

<?php
$sql = "SELECT * FROM " . TABLE_CONTACTS . " WHERE account_num='$acn'";
$rows = $db->query($sql);

while($rec2 = $db->fetch_array($rows)){
$friend[] = $rec2["friend"];
}

foreach($friend as $key){

$sql = "SELECT * FROM " . TABLE_SEARCH . " WHERE account_num='$key'";
$rows = $db->query($sql);

while($rec2 = $db->fetch_array($rows)){
	$u = unserialize($rec2["search_field"]);

	print_r($u);
}

}
?>

Link to comment
Share on other sites

Hello, I am having a problem pulling a record from mysql.....this is very strange to me and i don't understand why there is nothing being returned.

 

can someone please tell me if i am doing something wrong?

 

This code doesn't even return an error, it just doesn't work!

 

<?php
$sql = "SELECT * FROM " . TABLE_CONTACTS . " WHERE account_num='$acn'";
$rows = $db->query($sql);

while($rec2 = $db->fetch_array($rows)){
$friend[] = $rec2["friend"];
}

foreach($friend as $key){

$sql = "SELECT * FROM " . TABLE_SEARCH . " WHERE account_num='$key'";
$rows = $db->query($sql);

while($rec2 = $db->fetch_array($rows)){
	$u = unserialize($rec2["search_field"]);

	print_r($u);
}

}
?>

 

Theres no error because there isn't one. The problem is you PHP syntax. What are you trying to do with it? Looks like you are running the same thing twice, and what are you using as a framework.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...