The Little Guy
-
Posts
6,675 -
Joined
-
Last visited
Posts posted by The Little Guy
-
-
you are placing quotes around column names.
-
I currently have a varchar for my timestamp, I haven't changed it to a timestamp field because I wasn't sure if it would mess up my dates, the dates are in a perfect timestamp format though.
So, if I update the datatype of that field will I get an error, or worse, and invalid date?
-
This will add two markers to the map
<script type="text/javascript"> function initialize() { var myLatlng = new google.maps.LatLng(38.891033, -96.591797); var myOptions = { zoom: 3, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var myLatlng, marker; myLatlng = new google.maps.LatLng("44.6307","-93.3034"); marker = new google.maps.Marker({ position: myLatlng, map: map, title:"24.197.217.40" }); myLatlng = new google.maps.LatLng("44.8205","-92.9256"); marker = new google.maps.Marker({ position: myLatlng, map: map, title:"174.155.1.75" }); } function loadScript() { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize"; document.body.appendChild(script); } </script> <div id="map_canvas" style="width: 500px; height: 300px"></div> <script>loadScript();</script>
-
i used mysql and your using mysqli, you might want to change my function.
-
GoogleMaps.... API
-
your update needs to be below
$course_id = $_POST['course_id'];
and the "course_id" needs to have a $ in front of in the update query.
-
You would do something like this:
$first_name = mysql_real_escape_string($_POST['first_name']); mysql_query("update members set first_name = '$first_name' where member_id = 123;");
-
don't use FROM while using update, also you need to use set, other wise it won't update anything
for example:
update members set first_name = 'billy' where member_id = 123;
-
That doesn't make sense.
-
That doesn't really make sense.... but Ill try my best.
$array = array( "array1" => array(), "array2" => array(), "array3" => array() ); $is_array = is_array($array['array1']); if($is_array) echo "this array exists!"; else echo "this array does not exist ";
-
You would make your form kinda like this:
<form action="/process/processFiles.php" method="post"> <table> <tr> <td>Filename</td> <td>Archive</td> <td>Delete</td> </tr> <?php foreach(glob('../edit/news/news/*') as $file){ echo "<tr>"; echo "<td>$file</td>"; echo "<td><input type='checkbox' name='archive[]' value='$file' /> $file</td>"; echo "<td><input type='checkbox' name='delete[]' value='$file' /> $file</td>"; echo "</tr>"; } ?> </table> </form>
-
Using PFMaBiSmAd's code, I added some error checking:
<?php // your authentication/log in check code would go here... if(isset($_POST['submit'])){ if(isset($_POST['delete']) && is_array($_POST['delete'])){ foreach($_POST['delete'] as $value){ if(file_exists($value)){ echo "Delete $value<br />"; unlink($value); }else{ echo "File Not Found $value; Did Not Delet<br />e"; } } } if(isset($_POST['archive']) && is_array($_POST['archive'])){ foreach($_POST['archive'] as $value){ if(file_exists($value)){ echo "Archive $value<br />"; rename($value, "../archives/$filename"); }else{ echo "File Not Found $value; Did Not Move<br />"; } } } } ?>
-
I didn't code everything, so here is an example:
This is the page that has the main form of the files you want to move:
<?php foreach(glob('../edit/news/news/*') as $file){ echo "<input type='checkbox' name='file[]' value='$file' /> $file<br />"; } ?>
This is the page that processes the files once you submit the form:
<?php foreach($_POST['file'] as $file){ if(is_file($file)){ $filename = basename($file); rename($file, "../archives/$filename"); } } ?>
Note: I didn't test this.
-
This works for me:
<?php function preg_link_query($member){ return "@<a href='/file/'>$member</a>"; } $str = "This is a test @mike! whats up!"; echo preg_replace("/\@([a-zA-Z0-9]+)/e", "preg_link_query('$1')", $str); ?>
-
honestly, I am not sure, I would give it a try.
-
but....
When called' date=' set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.[/quote'] -
if your going to start it off with 0, might as well leave it, and set_time_limit sets how long the "Entire" page takes to execute
-
$filename = "/root/image/myimage.jpg"; if((bool)exif_imagetype($filename)){ echo "This is a valid image"; }else{ echo "This is not a valid image"; }
-
That's a phymyadmin thing -- I don't know.
phpmyadmin is 90% stupid
What do you even need a blob for? what could you possibly need to store that big that couldn't be stored in the file system?
-
Off topic..
If your going to hard code a value, in your query, might as well make it a MySQL default value.
On topic..
I looks to me that your second query needs the primary key from your first query.
-
my favorite language is english..
I was going to say that! HOW DARE YOU TAKE THE WORDS OUT OF MY MOUTH!!
-
power = speed
That is how I rate it.
-
sorry, datetime can actually be a timestamp with CURRENT_TIMESTAMP as the default
-
why do you have imageurl and imagepath? you can build those two based off the other data you have. Second the date field should be "datetime" not an int. it would be formatted like:
2011-12-12 13:12:20
Mysql query opinions
in Miscellaneous
Posted
I looking for your opinion on this:
I am trying to decide if it is a better idea to do one query using many joins or many queries a few joins, which way do you feel is easier to manage and/or faster to do?
I have been told that sometimes it is faster to do multiple small queries than it would be to do one larger join. What is your opinion on this?
here is an example that made me think of this, the first query returns everything needed, but it also returns a little extra which then requires extra php logic to format on the page. This particular query returns the game developers and publishers, so if there is 1 developer and 2 publishers, you will get 2 different publishers and 2 of the same developers.
Each one of these queries returns exactly what is needed, so now all you need to do is loop through each result set.
So, if you forgot the main question, what do you feel is a better method, many small queries or one large query (especially when using 1 to many and 1 to 1 in the same query)?