Jump to content

Some Prob


[dx]
 Share

Recommended Posts

Hi,What can be with this. I have installed Wamp Server on my PC and when using browsing page via localhost, everything is OK with script (PHP), and when I upload it to server (other machine), part of script won't work, and other part works fine.Is there any difference..Here is my code (part which don't work):

if (!$pr) {echo '<title>Site title</title><p class="projekti_naslov">Projekti</p>';	$izvadi_boards = mysql_query("SELECT name FROM $table_boards WHERE ID_CAT=$projekti_kategorija AND childLevel=1");	while ($boardsi = mysql_fetch_array($izvadi_boards)) {		$veza = $boardsi['name'];		echo "<table class='projekat_tabela'><tr><td class=subject>		<img src='../slike/reply_icon.gif' /> <a href='?pr=$veza'>" . $veza . "</a><br /></td>		<td class=broj_projekata>";		$broj_projekata = mysql_fetch_array(mysql_query("SELECT COUNT(subject) FROM $table_messages					INNER JOIN $table_boards ON $table_messages.ID_BOARD=$table_boards.ID_BOARD WHERE 					$table_boards.name=$veza"));		echo "Broj projekata: <b>" . $broj_projekata[0] . "</td></tr></table>";	}}

Link to comment
Share on other sites

Perhaps mysql isn't enabled on the remote server?

Link to comment
Share on other sites

@Synook , not error messages at all. And mysql database is set up same on my localhost and on server.I have other part of code with if ($pr) { and works perfectly on localhost and on server. Just this part won't work.@chibineku , db is ok, read sentence above.@jlhaslip , server: 5.2.9 , localhost: 5.2.6

Link to comment
Share on other sites

The MySQL functions don't report errors automatically, you need to check if an error happened and print the message yourself. The code you posted isn't doing that.

I have other part of code with if ($pr) { and works perfectly
What is $pr? You didn't include that code.
Link to comment
Share on other sites

<?PHPheader("Content-Type: text/html; charset=UTF-8");include "../baza.php";include "../head.php";$pr = $_GET['pr'];$ID = $_GET['ID'];echo '<p class="projekti">';mysql_query("SET NAMES 'utf8'");if (!$pr) {echo '<title>title page - Projekti</title><p class="projekti_naslov">Projekti</p>';	$izvadi_boards = mysql_query("SELECT name FROM $table_boards WHERE ID_CAT=$projekti_kategorija AND childLevel=1");	while ($boardsi = mysql_fetch_array($izvadi_boards)) {		$veza = $boardsi['name'];		echo "<table class='projekat_tabela'><tr><td class=subject>		<img src='../slike/reply_icon.gif' /> <a href='?pr=$veza'>" . $veza . "</a><br /></td>		<td class=broj_projekata>";		$broj_projekata = mysql_fetch_array(mysql_query("SELECT COUNT(subject) FROM $table_messages					INNER JOIN $table_boards ON $table_messages.ID_BOARD=$table_boards.ID_BOARD WHERE 					$table_boards.name=$veza"));		echo "Broj projekata: <b>" . $broj_projekata[0] . "</td></tr></table>";	}}elseif ($pr) {	if (!$ID) {	echo '<title>title page - Projekti - Projekti iz '.$pr.'. godine</title><p style="text-align: center;">';	$godine_projekti = mysql_query("SELECT name FROM $table_boards WHERE ID_CAT=$projekti_kategorija AND childLevel=1");	while ($godine = mysql_fetch_array($godine_projekti)) {		$godine = $godine['name'];		if ($pr != $godine) {		echo '<span style="opacity: 0.4;" class="year_button"><a href="/projekti/?pr='.$godine.'">' . $godine . '</a></span>';		}		if ($pr == $godine) {		echo '<span class="year_button"><a href="/projekti/?pr='.$godine.'">' . $godine . '</a></span>';		}	}	echo '</p><p class="projekti_naslov">Projekti iz '.$pr.'. godine</p>';	$pozovi_child_board = mysql_query("SELECT ID_MSG, ID_TOPIC, ID_MEMBER, subject, posterTime, posterName, body FROM $table_messages					INNER JOIN $table_boards ON $table_messages.ID_BOARD=$table_boards.ID_BOARD WHERE 					$table_boards.name=$pr ORDER BY $table_messages.ID_TOPIC ASC");	while ($boardch = mysql_fetch_array($pozovi_child_board)) {	$projekat['ctime'] = date('d.n.Y \u H:i:s', $boardch['posterTime']);	$projekat_postername = $boardch['posterName'];	$projekat['displayName'] = mysql_fetch_array(mysql_query("SELECT realName FROM $table_members WHERE memberName='$projekat_postername'"));	$projekat_memberid = $boardch['ID_MEMBER'];	$boardch_subject_id = $boardch['ID_TOPIC'];	$prvi_post = mysql_fetch_array(mysql_query("SELECT ID_FIRST_MSG FROM $table_topics WHERE ID_TOPIC=$boardch_subject_id"));	$zadnji_post = mysql_fetch_array(mysql_query("SELECT ID_LAST_MSG FROM $table_topics WHERE ID_TOPIC=$boardch_subject_id"));		if (($prvi_post[0] == $zadnji_post[0]) || ($prvi_post[0] == $boardch['ID_MSG'])) {		echo "<table class='projekat_tabela'><tr><td class=subject width='55%'><a href=\"?pr=$pr&ID=$boardch_subject_id\">" . $boardch['subject'] . "		</a></td><td class=objavio>Objavio: <a href=\"/forum/index.php?action=profile;u=$projekat_memberid\">		<b>" . $projekat['displayName'][0] . "</b></a> Vrijeme: <b>" . $projekat['ctime'] . "</b></td></tr></table>";		}	}		}	elseif ($ID) {		$naziv_projekta = mysql_fetch_array(mysql_query("SELECT subject, posterName, posterTime, body FROM $table_messages WHERE ID_TOPIC=$ID"));		echo '<title>title page - Projekti - Naziv projekta: '.$naziv_projekta[0].' ('.$pr.')</title><p style="text-align: center;">';	$godine_projekti = mysql_query("SELECT name FROM $table_boards WHERE ID_CAT=$projekti_kategorija AND childLevel=1");	while ($godine = mysql_fetch_array($godine_projekti)) {		$godine = $godine['name'];		if ($pr != $godine) {		echo '<span style="opacity: 0.4;" class="year_button"><a href="/projekti/?pr='.$godine.'">' . $godine . '</a></span>';		}		if ($pr == $godine) {		echo '<span class="year_button"><a href="/projekti/?pr='.$godine.'">' . $godine . '</a></span>';		}	}		$_postername = $naziv_projekta['posterName'];		$objavio = mysql_fetch_array(mysql_query("SELECT ID_MEMBER, realName FROM $table_members WHERE memberName='$_postername'"));		$_postertime = date('d.n.Y \u H:i:s', $naziv_projekta['posterTime']);		$id_member = $objavio[0];		echo '</p><p class="projekti_naslov">'.$naziv_projekta['subject'].'</p>';		echo "<table class='ot_projekat'>		<tr><td><p class='otvoren_projekat'>Objavio: <b><a href='/forum/index.php?action=profile;u=$id_member'>		$objavio[1]</a></b> Vrijeme: <b>$_postertime</b></p></td></tr>		<tr><td class='body_projekat'>". $naziv_projekta['body'] ."</td></tr></table>";		$daj_re_teme = mysql_query("SELECT ID_MSG FROM $table_messages WHERE ID_TOPIC=$ID");		while ($broj_teme = mysql_fetch_array($daj_re_teme)) {			$prvi_post = mysql_fetch_array(mysql_query("SELECT ID_FIRST_MSG FROM $table_topics WHERE ID_TOPIC=$ID"));			if ($broj_teme[0] != $prvi_post[0]) {				$daj_re = mysql_fetch_array(mysql_query("SELECT subject, posterName, posterTime, body FROM $table_messages WHERE ID_TOPIC=$ID AND ID_MSG=$broj_teme[0]"));				$daj_re['body'] = str_replace('[url=', '<a href=' , $daj_re['body']);				$daj_re['body'] = str_replace(']', '>' , $daj_re['body']);				$daj_re['body'] = str_replace('[/url>', '</a>' , $daj_re['body']);				$daj_re['body'] = str_replace('[img>', '<img class="index_img" src="' , $daj_re['body']);				$daj_re['body'] = str_replace('[/img>', '" />' , $daj_re['body']);				$daj_re['body'] = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','<a href=mailto:\\1>\\1</a>', $daj_re['body']);				$_postername = $daj_re['posterName'];				$_postertime = date('d.n.Y \u H:i:s', $daj_re['posterTime']);				$objavio = mysql_fetch_array(mysql_query("SELECT ID_MEMBER, realName FROM $table_members WHERE memberName='$_postername'"));				echo "<table class='ot_projekat'><tr><td>				<p class='otvoren_projekat'>Objavio: <b><a href='/forum/index.php?action=profile;u=$id_member'>				$objavio[1]</a></b> Vrijeme: <b>$_postertime</b><br /><br />Naslov: " . $daj_re['subject'] . "</p></td></tr>				<tr><td class='body_projekat'>" . $daj_re['body'] . "</td></tr></table>";			}		}	}}echo "</p>";include "../foot.php";?>

Edited by Haris S
Link to comment
Share on other sites

if (!$pr) {echo '<title>Site title</title><p class="projekti_naslov">Projekti</p>';	$izvadi_boards = mysql_query("SELECT name FROM $table_boards WHERE ID_CAT=$projekti_kategorija AND childLevel=1");	while ($boardsi = mysql_fetch_array($izvadi_boards)) {		$veza = $boardsi['name'];		echo "<table class='projekat_tabela'><tr><td class=subject>		<img src='../slike/reply_icon.gif' /> <a href='?pr=$veza'>" . $veza . "</a><br /></td>		<td class=broj_projekata>";		$broj_projekata = mysql_fetch_array(mysql_query("SELECT COUNT(subject) FROM $table_messages					INNER JOIN $table_boards ON $table_messages.ID_BOARD=$table_boards.ID_BOARD WHERE					$table_boards.name=$veza"));		echo "Broj projekata: <b>" . $broj_projekata[0] . "</td></tr></table>";	}}

In this part of code I just get "projekti" from <p> and nothing else. No data from db.

Link to comment
Share on other sites

It appears that this query is failing to select any results.

$izvadi_boards = mysql_query("SELECT name FROM $table_boards WHERE ID_CAT=$projekti_kategorija AND childLevel=1");

run the query in phpmyadmin to see what results you are getting there.Where does $projekti_kategorija come from?

Link to comment
Share on other sites

It's in file baza.php It's fine.I have same thing in if statement where $pr is not null $godine_projekti = mysql_query("SELECT name FROM $table_boards WHERE ID_CAT=$projekti_kategorija AND childLevel=1");And works fine

Link to comment
Share on other sites

Can't run query in PhpMyAdmin, becouse I don't have access link of it.And when echo variables, all of them are correct...EDIT: Solved, it was some mismatch in configuration. Sorry for dusturbing :)

Edited by Haris S
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...