Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
It means the query that select is attached to has failed. Place this after the query: echo mysql_error();
-
Change if($checkLink == true) to if($checkLink !== false)
-
How to display a numbered random output.. Help!!!!
Philip replied to tsuoshiro's topic in PHP Coding Help
Why not just use an ordered list in your html instead of tables? <ol><li>question</li></ol> -
Before // if data is successfully changed in database, send email to user Add echo mysql_error(); So it looks like: $result=mysql_query($sql); echo mysql_error(); // if data is successfully changed in database, send email to user if($result){
-
Because you set the value of title bar to "Hello, world". As for the text not showing uhh.....
-
Running that query once will alter the table to delete duplicates and add a unique property to the column. You only need to run it once, not every time. Since you ran it, you can now run the UPDATE ON DUPLICATE query each time.
-
You need to visit it via localhost (while running apache & php) - not just by going to the file.
-
change that query to ALTER IGNORE TABLE `addtrain` ADD UNIQUE (`myid`)
-
i wanna make it multi ( if else if else if ..)
Philip replied to egturnkey's topic in PHP Coding Help
I'd use a switch. switch($lang) { case 'ar': $language="arabic"; // run an include or whatever here... break; case 'es': $langauge = 'spanish'; break; case 'ru': $language = 'russian'; break; case 'en': default: $langauge = 'english'; break; } -
Yup
-
This will print the same thing either way - its a matter of which you prefer it to look like (not too much difference in code) <pre> <?php // Your grid $grid = array( array(0,0,0,0), array(0,0,0,0), array(0,0,0,0), array(0,0,0,0) ); // All your objects in one variable $objects = array( 'object1' => array( 'string' => 'A', 'position' => array( 'x' => 1, 'y' => 0 ) ), 'object2' => array( 'string' => 'B', 'position' => array( 'x' => 3, 'y' => 2 ) ), 'object3' => array( 'string' => 'C', 'position' => array( 'x' => 3, 'y' => 1 ) ), ); // Loop through each object, and set the position on the grid. foreach($objects as $o) { $grid[$o['position']['x']][$o['position']['y']] = $o['string']; } // Show the grid print_r($grid); // Or alternatively... // Your grid $grid = array( array(0,0,0,0), array(0,0,0,0), array(0,0,0,0), array(0,0,0,0) ); // Each object $object1 = array( 'string' => 'A', 'position' => array( 'x' => 1, 'y' => 3 ) ); $object2 = array( 'string' => 'B', 'position' => array( 'x' => 2, 'y' => 1 ) ); $object3 = array( 'string' => 'C', 'position' => array( 'x' => 3, 'y' => 3 ) ); // A list of the object names $objects = array('object1', 'object2', 'object3'); // Loop through each one - using variable variables foreach($objects as $o) { $o = $$o; $grid[$o['position']['x']][$o['position']['y']] = $o['string']; } // show the grid print_r($grid); ?>
-
Does column 'myid' have a unique property (check in PhpMyAdmin, or the like) & when you echo out $sql - does it show everything correctly?
-
It would actually require less processing than what you're using right now. Something like the following (untested of course), as long as myid is an unique key column: $sql = "INSERT INTO addtrain(myid, time, imgurl, etc) VALUES ('".$_POST['id']."', '".$ctime."', '".$table2."', 0) ON DUPLICATE KEY UPDATE time = '".$ctime."'"; And you should properly sanitize your inputs (the above query is not sanitized.)
-
I second that. Typically when I google something for programming in C, it almost always leads me there and has either an answer or an idea that sparked the answer.
-
You could just use INSERT ON DUPLICATE
-
That should be fairly easy to change. Didn't we used to have an OT bbcode a while back, or am I thinking of somewhere else?
-
Is just fine, just change the array variables to match your script.
-
[SOLVED] Remove http:// from a dynamic URL with php
Philip replied to unknown1's topic in PHP Coding Help
Uh you must not have a very broad amount of values in your testing range... Test url: http://www.testingphilsplace.com/test Output: www.esingilslace.comes Why? Because when you use an array in str_replace like that, it will replace every value... so every h, t, p, : and / in the entire string would be replaced with nothing. -
[SOLVED] Remove http:// from a dynamic URL with php
Philip replied to unknown1's topic in PHP Coding Help
Use str_replace for something that doesn't need regex. <?php $url=$rs_nw['Url']; $remove = "http://"; $replace = ""; $url = preg_replace($remove, $replace, $url); echo $url; ?> -
http://www.smashingmagazine.com/2009/08/26/vital-tips-for-effective-logo-design/ http://www.smashingmagazine.com/2009/06/25/10-common-mistakes-in-logo-design/ http://www.smashingmagazine.com/2009/04/30/60-beautiful-logo-design-tutorials-and-resources/ All 3 of those are decent articles on logo design, and the last has some good links
-
I was going to be generous and say $5. It's just some text with some plain effects IMO. But you're not asking for critiques, but just if I'd pay $50, and the answer is no.
-
[SOLVED] How to randomize mysql_fetch_array($result) ?
Philip replied to deko's topic in PHP Coding Help
An alias, using the AS keyword? -
Given they are the same lengths, with the same keys (in this case numerical).. no need for the count($array) in a for statement... thats why they made foreach $hello = array("hello", "guys", "hows", "it"); $goodbye = array("Its", "going", "find", "thanks"); $aiight = array("Good", "then", "thats", "well"); foreach($hello as $key => $value) { echo $value.' '.$goodbye[$key].' '.$aiight[$key].'<br>'; } Well - if they aren't the same length what do you want the script to do? Provide a blank space, or re-use another value somewhere?
-
It's because you have different configurations in your php.ini files, one to probably hide all the warning/notices and the other to show all. Undefined index is when you try to call a value from an array, who's key does not exist in the array. $array = array('hi' => 'hello', 'test' => 'testing', 'foo' => 'bar'); echo $array['foo']; // works, because foo is a valid key echo $array['joebob']; // will throw a notice, because we never defined the key 'joebob' echo $array['hi']; // works, again because we defined it. As for: Notice: Use of undefined constant, its when you don't use quotes around the key/index name. Without the quotes its considered a constant, and PHP then looks for the constant, and when it doesn't find it, it is smart enough to realize you meant it with quotes. See this example below, the first is correct, the second looks for a constant named foo first. $array = array('hi' => 'hello', 'test' => 'testing', 'foo' => 'bar'); echo $array['foo']; // right echo $array[foo]; // wrong
-
First try and I even won a prize!