-
Posts
24 -
Joined
-
Last visited
Never
Everything posted by systemick
-
This would work: if($result=file_get_contents("http://www.example.com")) { // handle good case } else { // treat error }
-
HuggieBear is right. You need to do some work for yourself. I suggest you start with the PHP functions strpos and strstr
-
Your query should be something like this $query = "select * from people where [column] = \"%$trimmed%\" order by firstName" Replace column with the name of the column you are searching on.
-
You can treat a string as an array in php. Try this $word = 'superman'; print 'first letter = '.$word[0];
-
You would need to pull the word out of the database then test it for the letters. If you had asked for letters 1,3&4 you would do somehting like this if ($secret_word[0] == 's' && $secret_word[2] == 'p' && $secret_word[3] == 'e') { <Do something> }
-
Try something like this $new_test = array(); foreach($test as $key=>$value) { if (strpos($value, 'test') !== FALSE) { $new_test[$key] = str_replace($value, 'hello', 'test'); } else { $new_test[$key] = $value; } }
-
Put a closing </option> tag after 'Please Select A Security Question' and remove the last </option> tag and see if that works
-
selecting a name from table 2 but get no returns
systemick replied to jeff5656's topic in PHP Coding Help
What I always do with SQL is print it out in the browser then paste it into my mysql client. I use a shell but i believe you can do this with PHPMyAdmin too. Doing this usually gives an error message which can then be used to diagnose the problem. -
Question regarding mysql_real_escape_string()
systemick replied to newbtophp's topic in PHP Coding Help
You would then need to use the stripslashes function to remove them: http://www.php.net/manual/en/function.stripslashes.php -
$result = mysql_query("SELECT MAX(idnum) as id from ready_aclassft"); $row = mysql_fetch_row ($result ); echo $row['id'];
-
Create file in Linux and write to it VIA PHP.
systemick replied to ChrisMartino's topic in PHP Coding Help
I'm not clear what you are trying to do here. Are you trying to send a file to a remote server or simply to write a file onto the file system on which your web server is located? ?I'm not clear why you need to use an editor to write this file? -
The mysql_real_escape_string function will prevent sql injection. The only other thing I would add is that you don't need the first 2 lines of code. You could just write $check = mysql_query("SELECT email FROM users WHERE email = '".mysql_real_escape_string($_POST['mail'])."'")
-
Being a fan of Drupal I always use Drupal & Ubercart. Drupal has a bit of a steep learning curve but once you get into it its a great app
-
How to do HTML validation at server side using PHP
systemick replied to phpuser2010's topic in Applications
When you say you want to validate the html, what do you mean exactly? -
You don't say if the timestamps are unix timestamps. If they are and you wanted the number between 6AM and 12PM today the sql would be: "select count(*) from event where event_time >= unix_timestamp('2010-08-06 06:00:00') and event time <= unix_timestamp('2010-08-06 12:00:00')
-
Before you output the html for the table simply insert $counter = 0;
-
Take a look at the usort function here: http://www.php.net/manual/en/function.usort.php You could define a function function compare ($array1, $array2) { if (array1['discount'] < array2['discount']) { return -1; } else if (array1['discount'] > array2['discount']) { return 1; } else { return 0; } } then pass the name of this function as the 2nd argument to usort
-
I use Fedora 12 and on my machine they are located in /var/lib/mysql but on a different OS they will be in a different place. my.cnf is the main mysql config file and the location should be listed in there. On Linux it is usually located in the /etc directory. If all else fails try searching your machine for a file or directory that is the same as the name of one of your databases.
-
Quick Question cant spot issue with insert script
systemick replied to fireice87's topic in MySQL Help
What error do you see when you run the script? -
Could you give a little more detail about what you have done and the problems you are having. How are you querying the database. Do you have any PHP code that you could put on here.
-
If you are using the 'mail' command you can use the -r option. Type man mail at the command line to see more information
-
Which version of Linux is best for webhosting server?
systemick replied to shortysbest's topic in Linux
I'd agree that the LAMP stack works pretty much on any server and that Centos works pretty well if all you need to do is serve PHP pages. There is one thing that I would say about Centos though. It can be difficult to install software on Centos sometimes because the packages quite often only exist for Fedora and Ubuntu. I have just set up a web application that needed to use a piece of third party software that is not widely available. Installing this software on my Fedora development box was easy but I tried for a whole day to install it on the live Centos server without success. Eventually I gave up and asked the hosting company to set uf a different server with Fedora on it. -
I'd highly recommend the tutorial at : http://svnbook.red-bean.com/en/1.1/index.html I don't use Netbeans but I'm sure that if you goggle Netbeans Subversion tutorial you will find something
-
Apologies for posting in the wrong place and thanks for the link. I'm going to take a look at Netbeans
-
Please forgive me if this has come up before. I searched and couldn't find anything. Could anyone recommend a decent free IDE for coding PHP. I'm on Linux and have always used Kate but now I have upgraded to Fedora 12 the latest version has some major changes and I'm no longer happy with it.