[dx] Posted September 21, 2009 Share Posted September 21, 2009 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 More sharing options...
Synook Posted September 21, 2009 Share Posted September 21, 2009 What is the error message?Your database is probably set up differently. Link to comment Share on other sites More sharing options...
chibineku Posted September 21, 2009 Share Posted September 21, 2009 Perhaps mysql isn't enabled on the remote server? Link to comment Share on other sites More sharing options...
jlhaslip Posted September 22, 2009 Share Posted September 22, 2009 check to see if the versions of php are the same. if they are different, check the manual for the functions you are using to confirm that they are compatible with both versions Link to comment Share on other sites More sharing options...
[dx] Posted September 23, 2009 Author Share Posted September 23, 2009 @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 More sharing options...
Synook Posted September 23, 2009 Share Posted September 23, 2009 Err, if there are no errors, what do you mean by "part of script won't work"? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 23, 2009 Share Posted September 23, 2009 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 perfectlyWhat is $pr? You didn't include that code. Link to comment Share on other sites More sharing options...
[dx] Posted September 23, 2009 Author Share Posted September 23, 2009 <?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";?> Link to comment Share on other sites More sharing options...
[dx] Posted September 25, 2009 Author Share Posted September 25, 2009 Anyone? Link to comment Share on other sites More sharing options...
Synook Posted September 25, 2009 Share Posted September 25, 2009 Err, if there are no errors, what do you mean by "part of script won't work"? Link to comment Share on other sites More sharing options...
[dx] Posted September 25, 2009 Author Share Posted September 25, 2009 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 More sharing options...
[dx] Posted September 26, 2009 Author Share Posted September 26, 2009 [LINK REMOVED] <- demo here without $pr[LINK REMOVED] <- demo with $pr Link to comment Share on other sites More sharing options...
[dx] Posted September 27, 2009 Author Share Posted September 27, 2009 anything? Link to comment Share on other sites More sharing options...
jlhaslip Posted September 27, 2009 Share Posted September 27, 2009 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 More sharing options...
[dx] Posted September 28, 2009 Author Share Posted September 28, 2009 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 More sharing options...
jlhaslip Posted September 28, 2009 Share Posted September 28, 2009 run the query in phpmyadmin to see what results you are getting there.and echo out the variables to confirm what you are looking for. Link to comment Share on other sites More sharing options...
[dx] Posted September 29, 2009 Author Share Posted September 29, 2009 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 Link to comment Share on other sites More sharing options...
justsomeguy Posted September 29, 2009 Share Posted September 29, 2009 If the query is correct and it's not returning any results then there are no results to return. If there were results and the query was correct then it would return them. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.