-
Posts
2,527 -
Joined
-
Last visited
Everything posted by DeanWhitehouse
-
o, my bad.
-
There is a OOP forum.
-
You could use WHERE in the sql instead of that if statement
-
[SOLVED] str_replace not doing what I feel it should
DeanWhitehouse replied to galvin's topic in PHP Coding Help
<?php $string ="<option class='' value='1'>Philadelphia Eagles</option>"; echo str_replace("class=''", "class='not'", $string); ?> -
If you can use a DB to store all the file details then you can use $_GET[]; to view specific files.
-
We need more information to help you
-
Yes but if the text file contains a lot of results then it will be slow and cause slow loading times for users.
-
Use an IF statement to check for there ip in the file first.
-
:s i dunno then,lol, i just no i couldn't get it to work properly when learning php so i now use that.
-
I didn't say it doesn't work, i said when i have used it before it didn't work. Although i think i use to do if(trim($name) == "") { }
-
When i have used trim if i enter a few spaces it doesn't work. Unless it has been updated in PHP 5
-
Your array key names. $database[dbpass] = "*****"; should be $database['dbpass'] = "*****"; You need to use quotes for everything except numbers or vars or defined words.
-
You have got the names of the rows wrong then. Check the row names in your database
-
The best way, in my opinion, is <?php function check_len($check) { $check = str_replace(" ","",$check); $check = trim($check); $check = strlen($check); return $check; } if (check_len($name) == 0) { echo "No name"; } ?>
-
First off use code tags for any code, and second off <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','586','height','447','src','../$fname_noext','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../$fname_noext' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="586" height="447"> <param name="movie" value="$fname_noext" /> <param name="quality" value="high" /> <embed src="$fname_noext" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="586" height="447"></embed> </object></noscript> should it not be <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','586','height','447','src','../<?php echo $fname_noext;?>','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','<?php echo "../".$fname_noext;?>' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="586" height="447"> <param name="movie" value="<?php echo $fname_noext;?>" /> <param name="quality" value="high" /> <embed src="<?php echo $fname_noext;?>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="586" height="447"></embed> </object></noscript>
-
It won't print anything if there are no rows. Try adding error_reporting(E_ALL); to the top of the code and see if there are any errors.
-
I would say that the top one is a better way of checking it though, but that is just personal preference.
-
[SOLVED] HTMLentities not showing hard returns/line breaks?
DeanWhitehouse replied to spiceydog's topic in PHP Coding Help
nl2br(); when you are reading from a database, or just displaying anything from a textarea. -
NP, solved button bottom left hand side.
-
$insert = "INSERT INTO `users` (username,password,email)", mysql_real_escape_string($username), mysql_real_escape_string($password), mysql_real_escape_string($email)); You end the sql statement with the )", And that also caused a parse error because you are trying to connect strings using commas . So fixed that, now the second error, a HTML one echo "User Added. <A href''<a href=\"home.html\">Click here</a> To Go Home."; You have set the href attribute of the anchor as another anchor. Edit: 3rd error i didn't see or fix ?> } ?> You end PHP so the last closing tag is printed as HTML not run as php.
-
<?PHP include "connect.php"; // Checks the database for a user with a particular user name $check = mysql_query("select ID from users where username='$username' limit 1;"); // get a row count of the number of rows found if(mysql_num_rows($check) == 1) { echo "Username Already In Use."; } else { if(isset($_POST['submit'])) { $username=$_POST['username']; $password=$_POST['password']; $email=$_POST['email']; if(strlen($username)<1) { print "You did not enter a username."; } else if(strlen($password)<1) { print "You did not enter a password."; } else { $insert = "INSERT INTO `users` (username,password,email) VALUES ('".mysql_real_escape_string($username)."','".mysql_real_escape_string($password)."','".mysql_real_escape_string($email)."'"); mysql_query($insert) or die("Could not insert comment" . mysql_error()); echo "User Added. <a href=\"home.html\">Click here</a> To Go Home."; } } ?> } ?>
-
You should read some PHP tutorials, maybe ones based around form processing. He says empty like <form action="" method="post"> See the action is empty and therefore it will post to the current script. And yes where you handle the value will is where if statements and probably more will come. But we are not here to do your homework (assignments) for you, we can provide references and point you in the right direction etc. Although Mchl doesn't seem to mind. Thanks, Blade280891 (Mr.Grumpypants)
-
So at each number (2.3 etc.) you want it to go into an array and then arrange them into an order highest to lowest. If so i think a mixture between explode and i think it is called sort(); should work http://www.php.net/explode http://uk3.php.net/manual/en/function.sort.php
-
[SOLVED] Crazy Quote/Apostrophe Situation
DeanWhitehouse replied to modchamp's topic in PHP Coding Help
Are you not putting anything inside the link? $linkd = "<a href=\"".$address."upload/". $ran1.$ran2.$_FILES['file']['name']."\">"; needs to be something like $linkd = "<a href=\"".$address."upload/". $ran1.$ran2.$_FILES['file']['name']."\">".$_FILES['file']['name']."</a>"; -
access a php array from input name="xyz"
DeanWhitehouse replied to johnhb's topic in PHP Coding Help
View the source code and check that the php is writing it correctly.