Posted: Thu Jun 22, 2006 10:51 pm
Ok, lets try it (tommorow) I hope quoting everything will help
but i got very sceptical by now
Thanks!
Thanks!
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php /* Created on: 6/25/2006 */
//www.confident.us/uc/event_gallery/select.php
require("../inc/db_conn.php");
# Content of db_conn.php
#
# $db_server = "****";
# $db_user = "****";
# $db_pass = "****";
# $db_name = "-main-";
#
$db = mysql_connect($db_server, $db_user, $db_pass);
mysql_select_db($db_name, $db)
?>
<html>
<body>
<?php
$sql_loc = 'SELECT * FROM `uc_club`';
$result_loc = mysql_query($sql_loc);
$rows = mysql_num_rows($result_loc);
echo "<b>Rows:</b> $rows <br>";
#Lets chek for errors
if(mysql_fetch_array($result_loc)){
//Good
}else{
//Errror
echo "There is an error in popolating variables ";
}
while ($row_loc = mysql_fetch_array($result_loc)) {
echo $row_loc["name"];
echo " ". $row_loc["name"] ."<br>";
}
?>
</body>
</html>Code: Select all
or die(mysql_error())Code: Select all
<?php /* Created on: 6/25/2006 */
//www.confident.us/uc/event_gallery/select.php
require("../inc/db_conn.php");
# Content of db_conn.php
#
# $db_server = "****";
# $db_user = "****";
# $db_pass = "****";
# $db_name = "-main-";
#
$db = mysql_connect($db_server, $db_user, $db_pass) or die(mysql_error());
mysql_select_db($db_name, $db)or die(mysql_error());
?>
<html>
<body>
<?php
$sql_loc = 'SELECT * FROM `uc_club`';
$result_loc = mysql_query($sql_loc) or die(mysql_error());
$rows = mysql_num_rows($result_loc)or die(mysql_error());
echo "<b>Rows:</b> $rows <br>";
$row_loc = mysql_fetch_array($result_loc) or die(mysql_error());
while ($row_loc = mysql_fetch_array($result_loc)) {
echo $row_loc["name"];
echo " ". $row_loc["name"] ."<br>";
}
?>
</body>
</html>This statement right here tells me this is a code issue, not a DB issue. Something is happening differently with the way you are interacting with your database on each server. Are running data through add_slashes() somewhere? If you are using one database, and hitting it from two different server setups, I can only surmise that the problem lies within the code that is processing the DB requests.alexus wrote:ok, im going to do it...
but I have ONE db
let me define the setup:
"Remote Server" = HTTP Apache FreeBSD+PHP + MySQL Server
"Local Server" = HTTP Apache WinXP + PHP
Code: Select all
<?
require("../inc/db_conn.php");
$db = mysql_connect($db_server, $db_user, $db_pass) or die("Could not connect to the database: " mysql_error());
if (!mysql_select_db($db_name, $db))
{
die("Could not select the database $db_name");
}
$sql = "select * from `uc_event` WHERE `date` >= now() ORDER BY `date`";
$result = mysql_query($sql) or die('Could not grab the event list: ' . mysql_error());
while ($row_news = mysql_fetch_array($result))
{
//mysql_free_result($result_loc);
echo $row_news["id"] .'<br>';
$place = $row_news["place"];
echo '<strong>We are trying to pass ' . $place . ' to the next query...<br />';
$sql_loc = "select * from `uc_club` WHERE `id`= $place";
$result_loc = mysql_query($sql_loc) or die('Could not query clubs table for ' . $place . ': ' . mysql_error());
while ($row_loc = mysql_fetch_array($result_loc))
{
print("<b>Case #1 (Local) </b> ". $row_loc["name"] ."<br>");
}
$sql_loc2 = "select * from `uc_club` WHERE `id`='$place'";
$result_loc2 = mysql_query($sql_loc2) or die('Could not run second query for ' . $place . ': ' . mysql_error());
while ($row_loc2 = mysql_fetch_array($result_loc2))
{
print("<b>Case #2 (Remote) </b> ". $row_loc2["name"] ."<br><br>");
}
}
?>