Wolphie
-
Posts
682 -
Joined
-
Last visited
Never
Posts posted by Wolphie
-
-
Of course it can, directly from the PHP website.
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML
-
Yes
$sql = mysql_query("SELECT * FROM table1 WHERE field1 LIKE '%". $string ."%' OR field2 LIKE '%". $string ."%'");
-
A) Why not separate the name into separate columns, and
B) You can always use mysql string functions in the query to extract the last name, but this or any use of php code to accomplish this will always be slower than using option A).
You've just got to remember, the over-all system will thereby be improved by doing so.
-
That's because it should be
if (!isset($_SESSION['id'])) { ... }
You want to check if the user hasn't logged in (i.e. the ID session variable hasn't been set) then re-direct to index.php otherwise display the page.
You've got it the opposite at the moment.
-
No they will be in the php code and not from a database, thank you to all who have replied so far
Well in that case, the code I posted before will work if the links are in an associative array. I've tried and tested it and it works fine as far as I'm aware.
-
json_encode simply sees '$(this).val()' as a string, which it is. If you want it evaluated by Javascript you will need to execute it via js's eval method.
I.e.
eval(json.data);
-
The code:
<?php if(isset($S_SESSION["id"])) { session_start(); connectdb(); $username = $_SESSION["username"]; $query = mysql_query("SELECT * FROM ov_users WHERE email = '".$username."'"); $rows = mysql_num_rows($query); if($rows = 0 || session_id() != $_session["id"]) { session_destroy(); header("location:index.php"); } }
The first line
$S_SESSION["id"]
should be
$_SESSION["id"]
Simple typo...
-
i know a small code it is not of ur requirement but i think this would give u an idea
<? //set the urls $urls = array("http://google.com" ,"http://hotmail.com" ,"http://phpfreecode.com" ); //set the text links $text = array("Google" ,"Hotmail" ,"phpfreecode"); srand(time()); //set the number in (rand()%3); for however many links there are $random = (rand()%3); echo ("<a href = \"$urls[$random]\">$text[$random]</a>")."<br>"; ?>
I don't see how that will echo all of the links?
Straight from PHP.net for associative arrays, keeping the key => value pairs in tact.
<?php function shuffle_assoc($array) { $keys = array_keys($array); // Shuffle the keys shuffle($keys); // Re-assign each new ordered key and value pair to a new array foreach($keys as $key) { $new[$key] = $array[$key]; } // Return the new array return $new; } // Array of websites, the URL is the key and the label is the value $sites = array('http://www.google.com/' => 'Google', 'http://www.phpfreaks.com/' => 'PHP Freaks'); // Loop through each element in the newly ordered array foreach (shuffle_assoc($sites) as $key => $val) { echo '<a href="'. $key .'">'. $val .'</a><br />'; } ?>
If you're getting these values from a database then it's best you use the RAND() MySQL function.
-
Does it not spit an error back out at you?
-
The quickest and easiest way I can see is
<?php $array['a'][0] = 3; $array['a'][1] = 1; $array['b'][0] = 2; $array['b'][1] = 1; $array['c'][0] = 0; $array['c'][1] = 1; foreach (array_keys($array) as $key) { $array[$key] = array_sum($array[$key]); } print_r($array); ?>
Array ( [a] => 4 [b] => 3 [c] => 1 )
-
I think the shortest and easiest way to do this would be to strip white spaces from the string completely, if that's what you're trying to achieve.
<?php $str = "hello# myname is#meh"; $str = str_replace(" ", "", $str); ?>
-
Why not just use str_replace to replace all white spaces? (if that's what you're after)
-
Nobody will write the code for you, check out the freelance forum if that's what you're after.
However, I will provide some resources for you to help you create your own mailing script.
http://php.net/manual/en/function.mail.php
http://php.net/manual/en/control-structures.foreach.php
Google is your friend, the Internet is a wonderful thing.
-
I agree, keeping PHPFreaks the way that it is has proved successful thus far. Don't try and fix something that doesn't need fixing, that's where Facebook is beginning to go wrong.
Although, I've been playing about with "MyBB". Which is another open-source and free forum solution, it's pretty nice.
-
I've just been assigned an urgent project at work regarding MSSQL Views.
However, our Intranet runs Drupal (which is written in PHP) so I was wondering if I just treat MSSQL Views the same as I would an ordinary MySQL table?
Thanks
-
A little respect and common sense goes a VERY long way.
-
We can only do so much in so little time.
-
Don't use float.
<div id="display_message_item"> <div id="list_right"> <img src="images/thumb_down.jpg" /> <img src="images/thumb_up.jpg" /> </div> <div id="list_left"> <p>by :: 767</p> <p> Enter your text here. Enter your text here. Enter your text here. </p> </div>
#display_message_item{ border: solid 1px #666666; min-height: 90px; margin: 10px 0 10px 0; padding-bottom: 5px; } #list_left{ width: 390px; } #list_right{ width: 80px; float:right; }
-
Try this:
<?php /* Incoming Subject and Email Variables - Fixed */ $emailSubject = 'Message from example'; $webMaster = 'example@hotmail.com'; /* Gathering Data Variables - User Data */ $email = $_POST['email']; $name = $_POST['name']; $telephone = $_POST['telephone']; $message = $_POST['message']; $body = <<<EOD <br><hr><br> Email: $email <br> Name: $name <br> Telephone: $telephone <br> Comments: $message <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as code */ $theResults = <<<EOD <html> <head> <title>JakesWorks - travel made easy-Homepage</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } --> </style> </head> <body> <div> <div align="left">Thank you for your interest! Your email will be answered very soon!</div> </div> </body> </html> EOD; echo $theResults; ?>
-
All cookies are domain specific. There is no such thing as an "open" cookie that is sent by the browser to all domains.
So then how does Facebook store cookies that enables other websites to identify your Facebook identity?
-
Other websites could quite possibly access your cookies (which is bad if they contain user sensitive information).
Facebook, for example have a few 'open' cookies where they're accessed by many websites you may visit.
-
Probably GET would be the best method.
header('Location: search.php?find=' . $find);
Then you could recover it in search.php using:
$_GET['find']
-
You should use mod_rewrite in a .htaccess file on your server.
-
The rest of the script wouldn't necessarily need to be executed. You're only needed to listen for any new messages that have been sent and retrieve them.
Wierd Opera thing
in PHP Coding Help
Posted
Just out of curiosity, why are you concatenating this?
Why not just use: