-
Posts
194 -
Joined
-
Last visited
Never
Everything posted by rallokkcaz
-
You'd have too make it so in the database there's a field that indicates if the user is online or not. It would be like: online = true when they sign in, and online = false when they sign out or the session expires. That's the only way todo it because sessions are local. Well there are other ways, but this is the most practical. -Zack
-
Okay guys, mysql_num_rows() is acting really strange, when ever i call it in my loop, it doesn't allow me to display other records that i need to come up. For instance I'm checking to see if a category has a subcategory but it isn't showing the categories that don't have subcategories. Here's the code: $sub_cats = mysql_query("SELECT * FROM `categories` WHERE sub = '". $result['name'] ."'"); while($row = mysql_fetch_array($sub_cats)) { $query = mysql_query("SELECT * FROM `categories` WHERE sub = '". $row['name'] ."'"); $rows_count = mysql_num_rows($query) or die(mysql_error()); if($rows_count > 0) { echo "<div class=\"category\" onclick=\"getCategories('". $row['name'] ."'); return false;\">". $rows_count ." ". UCWords($row['name']) ."</div>"; } else { //Just to check if it would even show the rows without sub-categories. echo "DSAKFKASDSA"; } } Anyone have any idea's why this is happening, or is this just some dumb mistake i'm making because it's been awhile since i've used PHP. -Zack
-
That didn't work. ???
-
Is it possible to do something like "mysite.com/user:1". I've tried stuff like: RewriteEngine on RewriteRule ^user:([0-9]+)$ profile.php?id=$1 [L] But it doesn't work, any ideas on what i'm doing wrong, or solutions other than the one i'm doing.
-
foreign key anyone!?!?!?!?!? ????????
-
you would probly have to set some variable that makes it so the user can only post 2 posts every minute or somthing like that im not sure how it would look in code but i might work
-
anyone?
-
so how exactly would the foreign key be coded into mysql??
-
no thats for my news table so how exactly would i use a foreign key?
-
k its got id user content topic time
-
yup, i had the LIMIT part in the wrong place and got it too work. and can someone answer my question?
-
i had to go man it was 2 am and i had school sorry
-
i currently have a news system, and want to allow people to add comments on what they think about the article. would i have to add another table, or another row into my database. any help? Thanks
-
how to make paged viewing for retrived data
rallokkcaz replied to rallokkcaz's topic in PHP Coding Help
so how would i make it show it shows links on the bottom and top of the page for pages? -
it means that your missing { } 's
-
how to make paged viewing for retrived data
rallokkcaz replied to rallokkcaz's topic in PHP Coding Help
anyone -
how to make paged viewing for retrived data
rallokkcaz replied to rallokkcaz's topic in PHP Coding Help
now i get this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,0' at line 1 here is the code <?php include 'header.php'; //connect to and select db $conn = mysql_connect('localhost','username','password') or die(mysql_error()); $db = mysql_select_db('pokebash_users',$conn) or die(mysql_error()); //get a list of the info from the table to make the linkies $page = $_GET['page']; // page number $X = ($page - 1); $Y = (5 * $page); $sql = "select * from news ORDER BY id desc Limit $X,$Y "; $result = mysql_query($sql, $conn) or die(mysql_error()); // for each row fetched from the results... while ($list = mysql_fetch_array($result)) { //make the custom linkie echo " <fieldset style='padding:5px; width:500px;'> <legend>"; echo $list['topic'] ; echo " "; echo "Posted at: "; echo $list['time'] ; echo " </legend> <table cellpadding='10px'> <tr> <td> "; echo $list['content'] ; echo " </td> </tr> </table> </fieldset><br> <a href='http://www.getmetola.com/post.php?id={$list['id']}'>View Topic</a> <br> <br> "; } // end while // if the user clicked on a linkie and therefore an id exists (the is_numeric is a basic security precaution) ... if (is_numeric($_GET['id'])) { // for easier var syntax handling $id = $_GET['id']; $sql = "select topic from news where id = '$id'"; $result = mysql_query($sql, $conn) or die(mysql_error()); $userfound = mysql_num_rows($result); if ($userfound) { $user = mysql_fetch_array($result); } // end if found } // end if there was a linkie clicked ?> -
how would i make it so when i grab info from the data base, instead of it making one long page of info it spreads it into different pages <?php include 'header.php'; //connect to and select db $conn = mysql_connect('localhost','username','password') or die(mysql_error()); $db = mysql_select_db('pokebash_users',$conn) or die(mysql_error()); //get a list of the info from the table to make the linkies $sql = "select * from news ORDER BY id desc"; $result = mysql_query($sql, $conn) or die(mysql_error()); // for each row fetched from the results... while ($list = mysql_fetch_array($result)) { //make the custom linkie echo " <fieldset style='padding:5px; width:500px;'> <legend>"; echo $list['topic'] ; echo " "; echo "Posted at: "; echo $list['time'] ; echo " </legend> <table cellpadding='10px'> <tr> <td> "; echo $list['content'] ; echo " </td> </tr> </table> </fieldset><br> <a href='http://www.getmetola.com/post.php?id={$list['id']}'>View Topic</a> <br> <br> "; } // end while // if the user clicked on a linkie and therefore an id exists (the is_numeric is a basic security precaution) ... if (is_numeric($_GET['id'])) { // for easier var syntax handling $id = $_GET['id']; $sql = "select topic from news where id = '$id'"; $result = mysql_query($sql, $conn) or die(mysql_error()); $userfound = mysql_num_rows($result); if ($userfound) { $user = mysql_fetch_array($result); } // end if found } // end if there was a linkie clicked ?> does anyone know how to do that???
-
hey i would but i g2g sorry guys night!
-
the field name is id
-
i get this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY id desc' at line 1 what does that mean
-
so how would that look like?
-
i wanna make it so when i list the topics in my news page it shows them the oppisite way instead of the the articles going 1, 2, 3. i want them to appear 3, 2, 1. here if the code for the view page. <?php include 'header.php'; //connect to and select db $conn = mysql_connect(INFOICANTSHOWGOESHERE!) or die(mysql_error()); $db = mysql_select_db('pokebash_users',$conn) or die(mysql_error()); //get a list of the info from the table to make the linkies $sql = "select * from news LIMIT 3"; $result = mysql_query($sql, $conn) or die(mysql_error()); // for each row fetched from the results... while ($list = mysql_fetch_array($result)) { //make the custom linkie echo " <fieldset style='padding:5px; width:500px;'> <legend>"; echo $list['topic'] ; echo " "; echo "Posted at: "; echo $list['time'] ; echo " </legend> <table cellpadding='10px'> <tr> <td> "; echo $list['content'] ; echo " </td> </tr> </table> </fieldset><br> <a href='http://www.getmetola.com/post.php?id={$list['id']}'>View Topic</a> <br> <br> "; } // end while // if the user clicked on a linkie and therefore an id exists (the is_numeric is a basic security precaution) ... if (is_numeric($_GET['id'])) { // for easier var syntax handling $id = $_GET['id']; $sql = "select topic from news where id = '$id'"; $result = mysql_query($sql, $conn) or die(mysql_error()); $userfound = mysql_num_rows($result); if ($userfound) { $user = mysql_fetch_array($result); } // end if found } // end if there was a linkie clicked ?> anyone know or is my description not good enough?
-
[SOLVED] check if it is certain user and allow to go to page
rallokkcaz replied to rallokkcaz's topic in PHP Coding Help
i do have a login page with sessions and all that stuff its just that all i want is to know how i would make the code i posted above work :-\ -
[SOLVED] check if it is certain user and allow to go to page
rallokkcaz replied to rallokkcaz's topic in PHP Coding Help
i wann make it so only the user admin can view the page, and if your not admin then it sends you somewhere else.