-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zane
-
supplied argument is not a valid MySQL result resource (solved)
Zane replied to jrodd32's topic in PHP Coding Help
check out this post http://www.phpfreaks.com/forums/index.php/topic,95376.0.html -
you'll probably need a custom function to do that... using a for loop to check and evaluate each character form right to left I'll help you out more when I get to school...
-
[code] $loginFoundUser = mysql_num_rows($Login); if ($loginFoundUser){ setcookie('Logged', 'True', time()+60*60); header('Location: index.php'); exit; }else{ $errorMessage = true; }[/code] [quote=php.net/mysql_num_rows] mysql_num_rows return the number of rows in a result set on success, or FALSE on failure. [/quote] $loginFoundUser will only be false if the SQL statement has an error in it.. you'll have change you if statement to [code]if ($loginFoundUser == 1{[/code]
-
I need to make a small modification to it this [code]if($index == "confirmPass" && $val == $tmp)[/code] should be [code]if($index == "confirmPass" && $val != $tmp)[/code]
-
hate to consider completely changing the code but this should work a little better and be less redundant [code]$message = null; $tmp = null; foreach($_POST as $index=>$value) { if($index == "username" && empty($val)) $message .= "You did not complete the username field properly.<br>\n"; if(($index == "password" && empty($val)) || ($index == "confirmPass" && empty($val))) $message .= "You did not enter a correct password.<br>\n"; else if($index == "password" && !empty($val)) $tmp = $val; if($index == "confirmPass" && $val == $tmp) $message .= "Your password entries did not match.<br>\n"; } echo $message;[/code]
-
lol..yeah I guess I could change those colors..I thought about it but lost my motivation ...and ended up here
-
perhaps you changed a setting in your MySQL server that phpmyadmin doesn't know about... like maybe the port number or something. Go check your Server config and your phpmyadmin conifg file and look for some differences
-
I don't think I could do CSS all day like some people, but I can't stay glued to the Actionscript panel in Flash for hours... so does that make me a ...............software developer ---- potentially? But I do like making graphics too.
-
lol...I got one. just for the reason that all my friends have it. I can't quite figure out why it's so popular either, it is kinda overated. I got facebook as well...but it's turning into this stalker news feed thing. About tells everyone everytime you fart. either one, I'll never get used to posting a blog about my life, which is all MySpace is. Blogs........and gossip, and chain letters..bleh
-
oh..I guessed I'm just used to the curly brackets it was burned into my head by either czambran or Barand..can't remember
-
just make sure you're calling this function of yours before you echo anything to the browser that includes nonPHP stuff like the DOCTYPE and HTML tags you gotta call it before any text would be normally displayed on the browser
-
right here [quote] // if a session does not exist but the form has been submitted // check to see if the form has all required values // create a new session if (empty($_POST['user'][b][color=red][size=12pt])[/size][/color][/b]) && [b][color=red][size=12pt]{[/size][/color][/b]empty($_POST['pass'])) {[/quote] get rid of the two characters marked in red
-
put the word localhost in double quotes mysql_connect("localhost",$username,$password);
-
then go to the begginning of the function call and put an @ symbol probably looks like $result = mysql_fetch_array($somequery) should be $result = @mysql_fetch_array($somequery);
-
The way I'd do this is to have something like a constant width in mind...like all images will have such a width and do some proportional math to the image's size like [code] $mysock = getimagesize("images/photo/image_name_here"); $setWidth = 200; function imageResize($width, $height, $target) { $newHeight = 0; $newHeight = ($setWidth * $height) / $width; return "width='{$setWidth}' height='{$newHeight}'"; } [/code]
-
I'm still lost on your question...what are you trying to do with the array for every refresh... and WHY isn't it working.... what is it not doing that you want it to do and a tip the file() function will automatically put the contents of a file into an array so this whole thing here [code]$a_advert = array(); $file = fopen($filename, "r"); while(!feof($file)) { $aQuotes[] = fgets($file, 4096); }[/code] can be shortened to [code]$a_advert = file($filename);[/code]
-
I don't know what you did either readdir() when used right.....will give you the filename...and that's it $file['type'] is kinda....undefined when you say it's not printing anything........are you testing this script on a php file/html file because from you included script....it's not doing anything...explaining the blank print
-
2 unrelated php questions... folder names and id3 tags
Zane replied to DaveLinger's topic in PHP Coding Help
yeah...just give it the correct filename/path and it'll work -
go to line 75 and take out the part at the end that says or die(mysql_error())
-
put this little snippet at the top of your script [code]if (!function_exists('mime_content_type')) { function mime_content_type ($f) { return trim(shell_exec('file -bi '.escapeshellarg($f))); } }[/code]
-
the reason it doesn't work is because readdir() doesn't return an array it return a string with JUST the filename in it you'll have to use the mime_content_type() function to check the filetype as simple change to your script [code] while (($file = readdir($handle))!==false) { if(mime_content_type ($file)=="application/x-php"| | mime_content_type ($file)=="text/html"){ //doesn't allow .php or .html files to be seen } else{ print "<a href='$file'>Click to download [/url]"; print $file.' '; } } [/code]
-
if (isset($_POST['test'])) { $test = "null"; } if you named any of you're form fields test in your HTML page this will return true what you need to do is compare $_POST['test'] to a value you gave it in the form eg.. [b]HTML[/b] [code]<input type='checkbox' name='test' value='1' />[/code] the default value is NULL...so $_POST['test'] will always be is[color=red]set[/color] if they submitted [b]PHP[/b] [code] if($_POST['test'] == 1) //The checkbox is checked [/code]
-
insert multiple records(lets see who good at their stuff)
Zane replied to ankycooper's topic in PHP Coding Help
We're not here to write you're code for you if you want that check out the PHP Freelancers form there are plenty of people willing to do it....but it might cost ya...who knows -
2 unrelated php questions... folder names and id3 tags
Zane replied to DaveLinger's topic in PHP Coding Help
Question 1 yes, use dirname($path); Question 2 yes, id3_get_tag($filename); -
[quote author=theverychap link=topic=58799.msg233640#msg233640 date=1115888338] 1. Sams teach yourself php in 24 hours (excellent book with some fundamental things we need to know, taught me a lot and i still occasionally look at it now). 2. peachpit press, 'php and mysql' quickstart guide (not as good as the others, they use old syntax etc) 3. sams php and mysql web development (this IS what i classed as my bible, its on its third edition now, id strongly recommend this book, absolutely great, taught me an awful lot of what i know today) 4. developers library advanced php programming (this book is quite hardcore, not too many php examples etc but has a wealth of information avout design patterns etc, 'a practical guide to developing large scale php applications' - damn good read!) 5. sybex (php freaks' eric rosebrocks book) 'creating interactive websites with php and web services' (i brought this solely because it was erics first book, to be honest its not the best book i have, but has some great chapters, plus a lot of it is familiar beacuse i have been a phpfreak for a few years now..)[size=2][b]no disrespect to Eric what-so-ever![/b][/size] 6. oreilly php pocket reference - nice little 'pocket sized' (!) book outlining all f the php functions etc - nothiing that cant be found on the net but for £7 its a must have, i keep it in my laptop bag (along with apache pocket ref and mysql pocket ref - good books) I would recommend sams or oreilly, you can guarantee a quality book from them. 99% of the books i have are by these guys and 95% of them are excellent books. stay away from the 'visual quickstart guides' (peachpit press) - it seems they write books a few years behind everyone else! Stuart / theverychap. [/quote] [quote author=redbullmarky link=topic=58799.msg233652#msg233652 date=1115889912] i like to add 'PHP and MySQL Web Development' by Luke Welling and Laura Thomson to the list of recommendations. It's not lame, neither is it hardcore, but it teaches you things from simple 'Hello World' scripts right through to developing content management systems, email programs, etc. It's pretty much written in 'English' speak too, not programmers speak, so people of all levels will easily find it useful. [/quote] [quote=zanus] The book I first bought was called PHP Fast and Easy Web Development Actually the only book I ever bought, the rest I learned from applying it, trial and error, and asking a lot of questions here Here's an amazon link to it http://www.amazon.com/PHP-Fast-Easy-Web-Development/dp/076153055X [/quote] If you have any other books to add or you'd like or get more information on one check out this post http://www.phpfreaks.com/forums/index.php/topic,58799.0.html