Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-12-2005, 01:40 AM can't figure it out
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
Ok, I cant figure this out... here's main.php:
PHP Code:
<?
include("include/session.php");
?>
<? 

//top of your page 
$gentime microtime(); 
$gentime explode(' ',$gentime); 
$gentime $gentime[1] + $gentime[0]; 
$pg_start $gentime

?>
<html>
<title>4D Realms</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<body>
<table align="right" width=100%>
<td width=36% align="left" valign="top">
<a href="http://4d.freeunixhost.com">
<img src="logo1.jpg" border="0">
</a>
<?
   
include ("stats.php");
?>
</td><td width=64% align="right" valign="top">
Hosts:<br>
<a href="http://www.thewebtalk.com/sites/in.php?id=31">
<img src="http://www.thewebtalk.com/sites/button.php?id=31" border="0" />
</a><br>
<a href="http://www.hawkee.com/"> <img src="http://www.hawkee.com/images/ads/88x31g.gif" width=88 height=31 border=0 alt="Download mIRC Scripts, Addons, and Bots"> </a>
<Br>
Link to us:<br>
<img src="logo.jpg" width=88 height=31 border=0 alt="Coding site for Experts">
</td>
<tr><td colspan="2">Please Excuse this broadcast, Hooray, the registration is back up and running! you may register as pleased, thank you, L0g2 St3w.
<?
if($session->logged_in){
   echo 
"<table width=\"100%\"><tr><td colspan=\"2\">";
   echo 
"<h1>Logged In</h1></td></tr>";
   echo 
"<tr><td colspan=\"4\">Welcome <b>$session->username</b>, you are logged in to <b>4D Realms</b>.</td></tr><tr>";
   echo 
"<td align=\"left\">[<a href=\"userinfo.php?user=$session->username\">My Account</a>] ";
   echo 
"[<a href=\"useredit.php\">Edit Account</a>] ";
   if(
$session->isAdmin()){
      echo 
"[<a href=\"admin/admin.php\">Admin Center</a>] [<a href=\"Guestbook.php\">Guestbook</a>] ";
   }
   echo 
"[<a href=\"process.php\">Logout</a>]</td></tr>";
echo 
"</table>";
?>
// This is the Guestbook.php.... Start
<form action="info.php" method="post"> 
<br><input type="text" name="name" value="<? echo "$session->username?>" disabled="1"><br> 
<textarea type="text" name="comm"></textarea><br> 
<input type="submit" value="Add"> </form>
<? 
if ($session->isAdmin()){
?>
<a href=proc.php>Delete all</a>
<?
}
?>
Messages: 
<table width=18%>
  <tr><td>
<? 
      $qu 
"SELECT * FROM shoutbox";
      
$res mysql_query($qu);
      echo 
"<table width=100%>";
      while (
$ro mysql_fetch_array($res)) {
      
$nam $ro["name"];
      
$msg $ro["comm"];
      echo 
$nam ":";
      echo 
" " $msg;
      echo 
"<hr align=\"left\" width=75%>";
      }
      echo 
"</table>";
?>
</td></tr>
</table>
// End of Guestbook.php
<?
}
else{
?>

<h1>Login</h1>
<?
if($form->num_errors 0){
   echo 
"<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
</table>
</form>

<?
}

/**
 * Just a little page footer, tells how many registered members
 * there are, how many users currently logged in and viewing site,
 * and how many guests viewing site. Active users are displayed,
 * with link to their user information.
 */
echo "</td></tr><tr><td align=\"center\"><br><br>";
echo 
"<b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo 
"There are $database->num_active_users registered members and ";
echo 
"$database->num_active_guests guests viewing the site.<br><br>";

include(
"include/view_active.php");

?>

<? 

//end of your page 
$gentime microtime(); 
$gentime explode(' ',$gentime); 
$gentime $gentime[1] + $gentime[0]; 
$pg_end $gentime
$totaltime = ($pg_end $pg_start); 
$showtime number_format($totaltime4'.'''); 
echo(
"This page was generated in " $showtime " seconds"); 

?>
</td></tr>
</table>
</body>
</html>
and here's Guestbook.php:
PHP Code:
<? 
include("include/session.php");
?>
<body>
<form action="info.php" method="post"> 
<br><input type="text" name="name" value="<? echo "$session->username?>" disabled="1"><br> 
<textarea type="text" name="comm"></textarea><br> 
<input type="submit" value="Add"> </form>
<? 
if ($session->isAdmin()){
?>
<a href=proc.php>Delete all</a>
<?
}
?>
Messages: 
<table width=18%>
  <tr><td>
<? 
      $qu 
"SELECT * FROM shoutbox";
      
$res mysql_query($qu);
      echo 
"<table width=100%>";
      while (
$ro mysql_fetch_array($res)) {
      
$nam $ro["name"];
      
$msg $ro["comm"];
      echo 
$nam ":";
      echo 
" " $msg;
      echo 
"<hr align=\"left\" width=75%>";
      }
      echo 
"</table>";
?>
</td></tr>
</table>
</body>
What I'm trying to do is integrate Guestbook.php into main.php, I've commented it out, but when i try it I get the error:
Quote:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/4d.freeunixhost.com/main.php on line 67
But when I try Guestbook.php bye itself it works! I dont understand what's hapening
__________________

Please login or register to view this content. Registration is FREE
The future is now with 4D Realms
log2 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-12-2005, 04:18 AM
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
ok I found that it says:
Quote:
Query failed: Table 'log2_stew.shoutbox' doesn't exist
And that shouldn't exist... that's in another MySQL database.. one that I'm not using, but I still don't know how to fix it
__________________

Please login or register to view this content. Registration is FREE
The future is now with 4D Realms
log2 is offline
Reply With Quote
View Public Profile
 
Old 03-12-2005, 08:04 AM
Experienced Talker

Posts: 36
Trades: 0
You've answered your own question, and it should be pretty self explainitary on what you need to do next. Connect to the right database or move the table over to the database you do use.
tress is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to can't figure it out
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12254 seconds with 12 queries