
Nhoj
Members-
Posts
223 -
Joined
-
Last visited
Never
About Nhoj
- Birthday 09/03/1989
Contact Methods
-
AIM
NHJohn1
- MSN
Profile Information
-
Gender
Male
-
Location
Clearwater, FL
Nhoj's Achievements

Newbie (1/5)
0
Reputation
-
I figured it out; for thos that might be curious it worked as follows: SET @rn :=0; SELECT @rn := @rn +1 AS `tempID`, `categoryID`, `categoryParent`, `categoryType`, `categoryName` FROM `categories` WHERE `categoryParent` = 0 ORDER BY `categoryName` DESC
-
Not sure if its possible, but I have a table of categories with an autoincrement field, looks like this: categoryID categoryParent categoryType categoryName 1 0 1 Computers & Networking 2 0 1 Arts & Crafts 3 0 1 Music 4 0 1 Motor Vehicles 5 0 1 Books 6 0 1 Sporting Goods 7 2 1 Direct From Artist 8 2 1 Wholesale Lots 9 5 1 Fiction 10 5 1 Non-Fiction The categoryID is the primary key set to auto_increment on insert, nothing special. What i'd like to be able to do, if possible, is when i select only a few, using a query like 'SELECT * FROM `categories` WHERE `categoryParent` = 0', have it pull the results with its unique ID and also have a temporary column with the result number it is. So that previous query should pull something like the following: temporary categoryID categoryParent categoryType categoryName 1 7 2 1 Direct From Artist 2 8 2 1 Wholesale Lots 3 9 5 1 Fiction 4 10 5 1 Non-Fiction If anyone can enlighten, thanks! Edit: The main idea behind it is to be able to sort the results ascending, descending, or even filter them via the category type and have that tempory column always increment by 1 starting from 1 and counting through the total, regardless of how it's filtered or sorted.
-
[SOLVED] How to return the value of a mysql count query in php?
Nhoj replied to blurredvision's topic in PHP Coding Help
You could also just do it all in one query with mysql_result like so: <? $count = mysql_result(mysql_query("SELECT COUNT(*) FROM hometeam_stats WHERE gamertag_id='{$standings['gamertag_id']}' AND season='$currentseason' AND win_loss=1"), 0); echo $count; ?> -
As darkwater said, you will need to use cURL. http://us.php.net/manual/en/ref.curl.php
-
You could look into phpMailer, it's a library of sorts that allows you to use send mail using SMTP. http://phpmailer.codeworxtech.com/
-
The best way to secure a cron job would be to put it outside an accessable directory. For example, if your web documents are served from /home/user/public_html, put your crons in /home/user/crons, that way no one can access them except the server itself or people with FTP access.
-
IE6 has some funkie session handling. Honestly, if you can figure it out that would be great. I've spent probably 10 - 12 hours on the same issue in the past and gave up. It's a very common issue: http://www.google.com/search?hl=en&q=IE6+and+php+sessions. Also there are a few suggestions for headers you can set that can be found on php.net.
-
?> <html> <body> <?php That part would be your problem more than likely. You cannot output ANYTHING to the browser if you are going to use any of the header() function commands after it. Try the following: <?php error_reporting(E_ALL); session_start( ); // if username and password are set and not empty then proceed with the rest of the process if( isset( $_POST[ 'username' ] ) && isset( $_POST[ 'password' ] ) && $_POST[ 'username' ] != '' && $_POST[ 'password' ] != '' ) { $link = mysql_connect( 'host', 'username', 'password' ); $db_selected = mysql_select_db('uname', $link); $username = mysql_real_escape_string($_POST['username'], $link); $password = mysql_real_escape_string($_POST['password'], $link); if (!$db_selected) { echo"Connection to the database failed. Please try again later." ; exit; } //checks for username and password in db table. $results = mysql_query("select * from users where username='" . $username . "' and password = '" . $password . "'" ,$link ) or die(mysql_error()); $num_rows = mysql_num_rows($results); //greater than zero if( $num_rows > 0 ) { $_SESSION['username'] = $username; //redirect header('Location:orion.php'); } else { echo 'You must be registered before you may log in.'; } } include( 'sessions.php' ); show_statement( ); if (isset($_SESSION['username'])) { echo '<br />'; echo 'Logged in as '.$_SESSION['username'].''; echo '<br /><a href="logout.php">Log out</a><br />'; } else { echo 'Please login to view your company files.<br />'; } ?> </body> </html> Also, what is in sessions.php? If you echo ANYTHING and then try to use header() it will give an error.
-
Date Format - Mon Jul 28 04:16:22 +0000 2008 - What is this?
Nhoj replied to JSHINER's topic in PHP Coding Help
got any code we can take a look at? Maybe some code that is used to display the date. -
CODE: Warning: implode() [function.implode]: Bad argument
Nhoj replied to delickate's topic in PHP Coding Help
is $admin_allowed_stores an array? -
echo "<form method=\"get\" action=\"battlesystem.php\">\n"; echo "<input type=\"submit\" value=\"Battle\">\n"; echo "</form>\n";
-
As darkwater said, it looks like that number is simply the amount of time it too to create the page. Not for the page to be sent to the user.
-
What exactly are you trying to acomplish by doing !> or !<? If you are trying to accomplish not greater than or not less than you could just flip the sign and remove the !. For example not greater than (!>) would obviously be anything less than, so <= would suffice. Anything less than or equal to is technically not greater than The same goes for the opposite.
-
<?php $time = time(); $hms = date('H:i:s', $time); echo $hms; ?> http://us3.php.net/manual/en/function.date.php
-
[SOLVED] Issue with a assigning a value to a Session.
Nhoj replied to Solarpitch's topic in PHP Coding Help
I think what he means is that: $product_id = $_GET['product_id']; doesn't appear to be sanatized. http://www.askbee.net/articles/php/SQL_Injection/sql_injection.html Might help, as if you use the $product_id to do a lookup or any interaction with MySQL you're wide open to SQL-injection attacks without sanitizing the input.