Hydrian
-
Posts
57 -
Joined
-
Last visited
Never
Posts posted by Hydrian
-
-
When i load my page. i get
Warning: mysql_fetch_array(): 9 is not a valid MySQL result resource in /home/a1761169/public_html/a40g/index.php on line 46
Here is my script
<?php session_start(); error_reporting(-1);ini_set('display_errors', 1); $myServer = ""; $myUser = ""; $myPass = ""; $myDB = ""; //Connection to the database $dbhandle = mysql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //Select a database to work with $selected = mysql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); $where = ""; if(isset($_GET['id'])){ $id = $_GET['id']; $where = " WHERE id = $id"; } //Declare the SQL statement that will query the database $query = "SELECT * FROM `topics`$where"; //Execute the SQL query and return records $result = mysql_query($query) or die('A error occured: ' . mysql_error()); //Show result //Free result set memory mysql_free_result($result); //Close the connection mysql_close($dbhandle); ?> <html> <head> </head> <body> <br> <div style="background-color:#CCCCCC; color:#; border-radius:5px;" align=''> <a href='create_topic.php'><b>New Topic<b></a> </div> <br><br> <?php while ( $record = mysql_fetch_array($result) ) { echo '<div id="content" >' . '<div style="background-color:#CCCCCC; color:#; border-radius:5px;">' . '<a href="index.php?id=' . $record["id"] . ' ">'. $record["topic_username"] .'</a>' . ' ' . '<a href="index.php?id=' . $record["id"] . ' ">'. $record["topic_name"] .'</a>' . '</div> ' . "<br>" . '<div style="word-wrap:break-word;div-layout:fixed; background-color:#CCCCCC; color:#; border-radius:5px;" width="500px" border="1">'; if(isset($_GET['id'])){echo $record['topic_date']; echo "<br><br>"; echo $record['topic_input']; } else { echo ""; } echo '</div></div>'; } ?> </body> </html>
What have i done wrong?
-
I have a table http://jays.netne.net/a40g/ it has manual inputted data. I want to know how to style data from the table. Can i just do this using a css style?
-
Im working on the login stuff
I get an unexpected '=' on line 9
<?php session_start(); include_once('connect.php'); if (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; $sql = " SELECT * FROM members WHERE username='".$username."'" AND password='".$password." LIMIT 1'; $res = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($res) == 1) { $row = mysql_fetch_assoc($res); $_SESSION['uid'] = $row['id']; $_SESSION['username'] = $row['username']; header ("Location: index.php"); exit(); } else { echo "Invalid login information. Please return to previous page."; exit(); } } ?>
-
I get
mysql_fetch_assoc():
supplied argument is not a valid MySQL result resource. when i load the page
<?php session_start(); include 'config.php'; mysql_select_db("my_db"); $result = mysql_query("SELECT * FROM `categorys`, SELECT * FROM `topics` "); while ($row = mysql_fetch_assoc($result)) { echo $row["cat_name"]; } ?>
-
what so suchas mysql_fetch(); ?
-
I get Resource id #10 when i load my page
Full Script
<?php session_start(); include 'config.php'; mysql_select_db("my_db"); $result = mysql_query(" SELECT * FROM `categorys`, SELECT * FROM `topics` "); ?> <?php include 'header.php'; ?> <div id="nar"> </div> <div id="content"> <?php print $result; ?> </div> <div id="nar"> </div> <?php include 'footer.php'; ?>
-
Fixed it but it still shows
Resource id #10
-
Yeah what did i do wrong
-
What did i do wrong?
-
I get Resource id #10 when i do
<?php print $result; ?>
when i load my page.
Here is my page code
<?php session_start(); include 'config.php'; mysql_select_db("my_db"); $result = mysql_query(" SELECT * FROM `categorys` "); $result = mysql_query(" SELECT * FROM `topics` "); $num = mysql_numrows($result); ?> <?php include 'header.php'; ?> <div id="nar"> </div> <div id="content"> <?php print $result; ?> </div> <div id="nar"> </div> <?php include 'footer.php'; ?>
-
starting with the db
users( linking into my members table)
topics
posts
catergorys
level(admin, mod, normal user)
-
Where would you suggest i start?
-
I want to know if you can make a application that allows a user to make a post(topic) and allow other users to reply to that post. Is there any way to do this. If i can do that, i want to try and create a forum with it. And style it how i want it. And then maybe after beta testing upload it to my site. Please i want to know if this is possible, it would be good if this can happen.
Cheers Hydroo
-
mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
Please help
-
well you should have a user system. It would make things alot easier.
-
For the file names just have a user having to register before uploading a file. Then set a var that randomises a url and set another function making sure that each url isnt the same. if a post is say like hasent been visited for 5months delete it
-
HELP
-
Where am missing those ()
-
where am i missing it.
-
Iv got a script. Now it it tells me there is a unexpected { at the end of line 9 which is i dont know why it tells me its unexpected. Please help, im a learning phper
while (($row = mysql_fetch_assoc($result)) !== false{ $users[] = $row; }
Full Script
<?php // fetchs all of the users from the table function fetch_users(){ $result = mysql_query('SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users` '); $users = array(); while (($row = mysql_fetch_assoc($result)) !== false{ $users[] = $row; } return $users; } ?>
-
content
-
-
I have a div which needs to be in the center but it acts as if there is a div in the way.
here is my css http://pastebin.com/AUwdVnkn
here is my index http://pastebin.com/SMR1QNWw
-
I listen to then tho
Order by newest
in PHP Coding Help
Posted
Im running a testing forum iv made from scratch, i want the posts to be order by newest, but there going as, order by oldest. How come this happens.
Thats the page i want the topics to go order by descending