Jump to content

newb

Members
  • Posts

    454
  • Joined

  • Last visited

Everything posted by newb

  1. k the code is this: [code=php:0] $query = mysql_query("INSERT INTO $table_users VALUES('$userid', '$first_name', '$last_name', '$email_address', '$username', '$mdpwd', '$today')"); if ($name == "reg") { echo $query; $sql = mysql_query($query) or die(mysql_error()); } else { [/code] all it did was give me [quote] Query was empty[/quote]
  2. hmm didnt echo anything
  3. ok i changed the query now to [code=php:0]$sql = mysql_query("INSERT INTO $table_users VALUES('$userid', $first_name', '$last_name', '$email_address', '$username', '$mdpwd', '$today')");[/code] but now i get this error: [quote] Query was empty[/quote] whats that mean :s
  4. [code=php:0] $sql = "INSERT INTO $table_users VALUES('$userid', $first_name', '$last_name', '$email_address', '$username', '$mdpwd', '$today')"; if ($name == "reg") { $query = mysql_query( $sql ) or die(mysql_error()); } else { [/code] i get this error: [quote] 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 'VALUES('0', dfg', 'fdg', 'gfdg', 'gfd', '6289f8aefb7e446ab0a0f10d027e6c68', 'Aug' at line 1[/quote]
  5. k im working on a cms and im not sure how i do usergroups like admin, moderator, member, guest, etc. how would i go about doing it? do i absolutely HAVE TO use/learn bitwise in order to do it, or can i do it through just mysql and php? :s
  6. oh nevermind i figured it out, i had to add $ to mod_active. works now thx.
  7. u cant decrypt md5! show me proof u liar!
  8. [code]<?php // Begin Default Module Code if ( $_GET['name'] == NULL ) { $sql1 = mysql_query("SELECT * FROM p16_modules WHERE default_module = 1 LIMIT 1", $connection);  $row = mysql_fetch_array( $sql1 ); $mod_active = $row['active_module']; $modtitle = $row['title']; $modpath .= "modules/".$modtitle."/".$file.".php"; if ( mysql_num_rows( $sql1 ) < 1 ) { echo "<font face='Tahoma' size='1'><b>Oh my god! No default module!!</b></font>"; } else if ( mysql_num_rows ($sql1 ) == 1 & mod_active == 1 & file_exists($modpath)) { include($modpath); } else { include($deactive); } } } // End Module Code ?> [/code] The module is active and the file exists, yet it includes $deactive. any idea why?? please help!
  9. oh nevermind, i figured it out, i had to do a separate query for all of them like this: [code]<?php require "sources/config.php"; //create connection $connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server."); //select database mysql_select_db("$mysql_database", $connection) or die ("Couldnt select the database. ".mysql_error()); $sql = mysql_query("SELECT data FROM `p16_blocks` WHERE id IN (0) ORDER BY `id` ASC", $connection); $sql1 = mysql_query("SELECT data FROM `p16_blocks` WHERE id IN (1) ORDER BY `id` ASC", $connection); $sql2 = mysql_query("SELECT data FROM `p16_blocks` WHERE id IN (2) ORDER BY `id` ASC", $connection); $row = mysql_fetch_row($sql);   $midlink = $row[0];     $row1 = mysql_fetch_row($sql1);   $footerlink = $row1[0];     $row2 = mysql_fetch_row($sql2);   $copyright = $row2[0]; ?> [/code]
  10. well wtf, how do i make it equivelent to record 1???
  11. wtf. $row[1] and $row[2] do hold someting. they hold the information stored in the data field just like $row[0] does. its shown right here: http://img205.imageshack.us/img205/7595/tableod4.jpg
  12. ya i see what u mean. i tried implementing the code in a template system i made, but it kinda failed. well, the code worked, but the template repeated itself downward, it made 3 copies of itself going down. [code]<?php include "sources/config.php"; //create connection $connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server."); //select database mysql_select_db("$mysql_database", $connection) or die ("Couldnt select the database. ".mysql_error()); $sql = mysql_query("SELECT data FROM `p16_blocks` WHERE id IN (0,1,2) ORDER BY `id` ASC", $connection); // STEP 1 // html definitions - format results by row while ($row = mysql_fetch_row($sql)) {   $midlink = $row[0];   $footerlink = $row[1];   $copyright = $row[2];   include $tpath."header.php"; echo $midlink; include $tpath."structure.php"; include $tpath."structure2.php"; echo $footerlink; echo $copyright; include $tpath."footer.php"; }?>[/code]
  13. ugh, i figured out the problem. [code] <?php include "config.php"; //create connection $connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server."); //select database mysql_select_db("$mysql_database", $connection) or die ("Couldnt select the database. ".mysql_error()); $sql = mysql_query("SELECT data FROM `p16_blocks` WHERE id IN (0,1,2) ORDER BY `id` ASC", $connection); $row = mysql_fetch_row($sql); // STEP 1 // html definitions - format results by row while ($row = mysql_fetch_row($sql)) {   $midlink = $row[0];   $footerlink = $row[1];   $copyright = $row[2];     echo $midlink;   echo $footerlink;   echo $copyright; } ?> [/code] I needed to remove [code]$row = mysql_fetch_row($sql);[/code]. Fix: [code] <?php include "config.php"; //create connection $connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server."); //select database mysql_select_db("$mysql_database", $connection) or die ("Couldnt select the database. ".mysql_error()); $sql = mysql_query("SELECT data FROM `p16_blocks` WHERE id IN (0,1,2) ORDER BY `id` ASC", $connection); // STEP 1 // html definitions - format results by row while ($row = mysql_fetch_row($sql)) {   $midlink = $row[0];   $footerlink = $row[1];   $copyright = $row[2];     echo $midlink;   echo $footerlink;   echo $copyright; } ?> [/code]
  14. yeah i know, the only field that i needed at the moment was the data field, i was planning on utilizing the other fields later on.
  15. [quote author=thorpe link=topic=103059.msg410051#msg410051 date=1154762107] [quote]bah, ur code almost works thorpe, except $midlink doesnt show. [/quote] Because (AS IVE SAID!!!) your only selecting one field! [/quote] and hows that a problem? i dont get it, which fields should i select :s
  16. btw i tried while ($row = $row = $row nothing happened
  17. [code] <?php include "config.php"; //create connection $connection = mysql_connect("$mysql_host", "$mysql_login", "$mysql_pass") or die ("Couldnt connect to the server."); //select database mysql_select_db("$mysql_database", $connection) or die ("Couldnt select the database. ".mysql_error()); $sql = mysql_query("SELECT data FROM `p16_blocks` WHERE ID IN (0,1,2) ORDER BY `id` ASC", $connection); $row = mysql_fetch_row($sql); // STEP 1 // html definitions - format results by row while ($row = $row = mysql_fetch_row($sql)) {   $midlink = $row[0];   $footerlink = $row[1];   $copyright = $row[2];     echo $midlink;   echo $footerlink;   echo $copyright; } ?>[/code] bah, ur code almost works thorpe, except $midlink doesnt show. the other two blocks generate though (footerlink and copyright) [code] <p align='center'>Home • Affiliates • Servers • Contact • Teams • Signup • Resources • Information • Schedule • Results • Forums • Captains<br /><p align='center'>Copyright 2006 © <b>p16draft.net</b>. All Rights Reserved.</p> [/code] thats what generates on the html page now
  18. [quote author=thorpe link=topic=103059.msg410041#msg410041 date=1154761079] Look at your query!!!! [/quote] what about it?
  19. [quote author=thorpe link=topic=103059.msg410039#msg410039 date=1154760900] [quote]but still the other html blocks arent showing up.[/quote] The code your posting produces NO html. Your also only selecting from the [i]data[/i] field in your query. [/quote] thats the only field i need to select from. at the moment, i just want to grab data from the table and echo it into the page and for some reason, it fails to do that.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.