
aim25
Members-
Posts
81 -
Joined
-
Last visited
Never
Everything posted by aim25
-
Is it useful to save sessions (eg. session IDs and session date)?
-
I agree with DarkWater, AJAX is the most efficient for this.
-
Have an IF statement that checks if the photo ID exists before you output the photo.
-
Quick yes or no: Can you instantiate multiple classes to one variable? eg. $var = new CLASS; $var = new CLASS2; Thank you for the help.
-
Quick yes or no: Is this right for validating a string (between 5 to 15 characters) which may consist of A-Z (both capital and lower case), 0-9, hyphen(-), and underscore(_)? /[^a-zA-Z0-9_\-]/ Thank you for the help.
-
Wrong section...
-
My bad, the i focused on teh code you provided.
-
Post some code.
-
That doesn't really answer the question... Sorry.
-
Is it possible to call a function within another function? Example: <?php class MAIN { function A() { .. some code } } class SOMETHING extends MAIN { function B() { $var = new MAIN; $var->A(); } } ?>
-
TY, that clears makes things a lot more clear.
-
Here is a good example. Play with it a bit. <?php $cds = array( 'Christina Aguilera'=>array( 'Impossible', 'Beautiful', 'Dirrty' ), 'Pink'=>array( 'Just like a pill', 'Family potrait', 'Missundaztood' ), 'Kelly Rowland'=>array( 'Stole', 'Obsession', 'Past 12' ) ); echo '<p><b>How many CDs in our collection?</b><br /> There are '.sizeof($cds)." CDs in our collection.</p>\n"; echo "<ol>\n"; foreach( $cds as $singer=>$songs ) { echo ' <li><b>'.$singer."</b>.<br />\n"; echo " <em>Songs</em>: </li>\n"; echo " <ul>\n"; asort( $songs ); // sorts the list of songs foreach( $songs as $song ) { echo ' <li>'.$song.".</li>\n"; } echo " </ul>\n"; } echo "</ol>\n"; ?>
-
My script has many classes and functions. After a while of coding i came up with a few questions. 1. If i have a variable named $temp in function A(), is it the same as the $temp in function B()? class SOMETHING { function A() { $temp; } function B() { $temp; } } 2. Lets say i have 2 classes (class A, class B) which both extend from class MAIN. In MAIN there is a variable declared; $temp. If the value of $temp is changed in class A, then accessed in class B, is the value passed between the classes? class MAIN { var $temp; } class A extends MAIN { $this->temp = 4; } class B extends MAIN { echo $this->temp; }
-
Hey, I'm working on a registration script. But as i went through i started thinking about security. So i searched it and i got a few commands. - mysql_real_escape_string() - magic_quotes_gpc() I'm not sure how these work, and which one is better. But I've been advised that i have to use addslashes() with magic_quotes_gpc. Then I also saw things like str_replace() being used, and other ways of taking the "magic quotes" out of the string. So whats the best way to protect against sql injections?
-
WOW I HAVE BEEN CORRECTED BEYOND COMPARE. thank you alot, this is going to come in really useful.
-
thank you for the replies, but no cake , still getting that error. can it just be my computer?
-
<?php $dbHost = 'localhost'; $dbUser = 'AIM25'; $dbName = 'dbuser'; $dbPass = '********'; $dbLink = mysql_connect($dbHost, $dbUser, $dbPass); if(!$dbLink) die("Could not connect to database. " . mysql_error()); mysql_select_db($dbName); $queryNameCheck = mysql_query("SELECT * FROM members WHERE userid = '$userName'", $dbLink); $intNamesInUse = mysql_num_rows($queryNameCheck); echo $intNamesInUse; ?> when i run that i get: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource. not sure how to fix it but i think its $queryNameCheck. Please help.
-
ooo, THANK YOU SOOO MUCH, cant belive i missed that , sorry if i bothered you.
-
$dbLink = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass); if(!$dbLink) die("Could not connect to database. " . mysql_error()); mysql_select_db($this->dbName); $queryNameCheck = mysql_query("SELECT * FROM members WHERE userid = '$userName'", $link); $intNamesInUse = mysql_num_rows($queryNameCheck); $queryMailCheck = mysql_query("SELECT * FROM members WHERE usermail = '$userMail'", $link); $intMailInUse = mysql_num_rows($queryMailCheck); i have this code, but i keep getting errors when i run it. Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\xampp\htdocs\WWG\test.php on line 34 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\WWG\test.php on line 35 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\xampp\htdocs\WWG\test.php on line 37 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\WWG\test.php on line 38 Does anyone know what those mean? Thanks ahead of time.
-
Have you made a function called db_connect()?
-
And for images <img href="image url" />
-
Yes. just replace the text with html. Like instead of www.google.com //do <a href="http://google.com/">Click here</a>
-
When dealing with a large amount of pages, is it better to dynamically create from the database then cache each page in a folder, or to dynamically create it using info from a database every time someone access's the page? help is appreciated. Thanks ahead of time.
-
When dealing with a large amount of pages, is it better to have them made and saved (cached), or to have them dynamically created every time?