AyKay47
Members-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Everything posted by AyKay47
-
You can use preg_match to accomplish this $pattern = '~^http://[\w\d]+\.[com|net|org|gov]/[\w\d]+/([\w\d])+/$~i'; //can add more extensions $subject = "http://thedomain.com/id/xxxx/"; preg_match($pattern,$subject,$matches); print $matches[0]; //first match
-
Not sure with this one, the SQL syntax is correct, have you tried debugging your query using mysql_error?
-
This is for the new website Colors are pretty nice, header is huge, login information is offset and doesn't look right, maybe move to the left
-
There are better alternatives to changing directory permissions to 0777, which can be very dangerous. 1. you can make the directory using mkdir which will allow PHP access to the directory without having to change permissions. 2. You can use PHP's ftp functions to move the file into the specified web directory http://us3.php.net/manual/en/book.ftp.php
-
to print out each individual result, you would have something like $html = file_get_contents($html); preg_match_all('/'http:\/\/website.com\/.+#1/', $html , $strng); print $strng[0][0]; print $strng[0][1]; //etc... or you can use a foreach loop foreach ($strng as $val) { echo $val[0] . "\n"; echo $val[1] . "\n"; echo $val[2] . "\n"; echo $val[3] . "\n"; echo $val[4] . "\n"; }
-
Entries posting twice to database and blank entries
AyKay47 replied to deebler's topic in MySQL Help
i linked the mysql_real_escape_string that I wrote to the PHP documentation on the function, will tell you everything that you need to know about it -
Yeah, Ludacris doesn't make much sense to me either. lol... do what? tell members where the button is?
-
Entries posting twice to database and blank entries
AyKay47 replied to deebler's topic in MySQL Help
which part of what I said do you not understand? $sql="INSERT INTO database (id, name, address, city, state, zip, cell, email, keyword, kids, visited, info) VALUES ('','$name','$address','$city','$state','$zip','$cell','$email','$keyword','$kids','$visited','$info')" //use variables instead, this will allows you to sanitize the input before insertion as well -
this is a site for "volunteers" to answer questions that members have. Most of these people ansering questions check here between work breaks etc..Forcing someone to mark a topic as solved is ludacris and doesn't make sense...I must admit that sometimes it is annoying to not know whether or not a topic has been solved or not, but the admins here at phpfreaks have kindly placed a "Topic Solved" button in the lower left hand of each thread for the OP to mark as solved for other members notification. Whether they choose to use it is up to them. If you really would like people to use it more, perhaps you can advise newer members as to where this button is....
-
Entries posting twice to database and blank entries
AyKay47 replied to deebler's topic in MySQL Help
1. you should be sanitizing your data before insertion into your database table using at least mysql_real_escape_string 2. When inserting, insert the variables that you have declared instead of the $_POST variables themselves, much cleaner and makes it easier to avoid unnecessary errors. -
looks to be valid syntax, you will need to try it
-
holy multi-dimensional array batman!
-
this will take you step by step on creating an XMLHttpResponse via AJAX and submit data via POST/GET methods
-
what does a "view source" in your browser show?
-
you said it doesn't submit anything into your db, but does it take you to update.php?
-
So when you submit your form, you aren't even taken to update.php? What does your update() function look like?
-
as long as $divisions is an array, your foreach loop should work. What errors do you receive when running this script?
-
the part where he echos HTML echo '<div style="font-family: serif; font-size: medium">Hello World</div>'; you cannot have HTML in php tags like you have shown, must be echoed/printed, must be parsed as a string
-
if it is not necessary, most certainly remove it. Also, you can look into using mysql_free_result to free all memory associated with your mysql identifier, if you are using multiple queries
-
I would approach this a different way.. $pattern = "~([A-Z])([A-Z]+)~s"; $arr = array(); preg_match_all($pattern,$subject,$matches); foreach($matches as $value){ $value = ucwords(strtolower($value)); $arr[] = $value; } print_r($arr);
-
you can insert into your db table the NOW() function. Then compare the difference of the time stored to the current time
-
I would need to see the entire for loop code in order to suggest methods of optimizing your code. As I see it now, you are looping a loop 500 times for each iteration of the while loop.....terrible idea, no wonder your memory expires
-
same table for optimization, refer to here gives information on timestamp and datetime formats