The Little Guy
-
Posts
6,675 -
Joined
-
Last visited
Posts posted by The Little Guy
-
-
I am not usually a fan of deleting data from a table, and I don't recommend doing it (but it also depends on what the table is for). You should have a toggle field, set it to "1" for an active user, or "0" for an inactive/deleted user.
<?php if (isset($_POST['escape']) || (isset($_POST['suicide']))) { // Why here is nothing wrote ??? }elseif(empty($_POST['agree'])){ echo "You need to check the box"; }else{ mysql_query("update users set is_active = 0 where id = ".(int)$_SESSION['user_id']); } ?>
-
It shouldn't, but your table should have default values, such as null.
-
Try this:
<?php $haystack = $_GET[q]; $query ="SELECT * FROM research_job_searches"; $result=mysql_query($query) or die ("Connection to database table failed. 35. " . mysql_error()); $nrows=mysql_num_rows($result); if ($nrows > 0){ while($record = mysql_fetch_array($result, MYSQL_BOTH)){ $needle = $record[research_job_search_url_keyword] . "-jobs"; echo $needle."<br>"; } } ?>
-
I am trying to test whether or someone clicks on the button or not in a popup window I tried this, but it doesn't work:
var mw = window.open("http://facebook.com/sharer/sharer.php?u="+window.location.toString(), 'facebook', 'status=0,toolbar=0,height=350,width=550,scrollbars=no,resizable=no'); $(mw.document).load(function(){ $(document).click(function(){ alert("hi"); }); });
Is this even possible?
-
So it is without an equal sign?
yup, just like a select.
-
UPDATE con SET contribution = '$contribution', category = '$contribution_category', description = '$contribution_description' limit 1
-
then list the columns you want in the select like this:
create table DatabaseB.TableA select col1, col3, col4, col10 from DatabaseA.TableA
-
if the databases are on the same server and the same user has access to them, you could do this:
create table DatabaseB.TableA select * from DatabaseA.TableA
-
how are you getting these numbers(The 300 and 1400)? from a: form, database, other?
-
I just realized that you have a select in the query, give this a try (I didn't try it, I don't even know if it is a valid query):
INSERT INTO table_members (name) values ((SELECT application.Name FROM application WHERE application.ID = '$member')) ON DUPLICATE KEY UPDATE table_members.name = values(table_members.name)
-
cURL and file:
$url = "http://someurl.com/something"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETRUNTRANSFER, ture); curl_setopt($ch, CURLOPT_BINARYTRANSFER, ture); $opt = curl_exec($ch); $handle = fopen("myfile.txt", "wb"); fwrite($handle, $opt); fclose($handle);
-
Try this:
INSERT INTO table_members(name) SELECT application.Name FROM application WHERE application.ID = '$member' ON DUPLICATE KEY UPDATE table_members.name = values(application.Name)
-
can you show your query?
-
create 2 tables, one for the users, and one for each website.
The users table would have a user id and info about each user and a unique id.
The website table would have a unique website id and who owns it along with the status and priority.
something like this:
<?php $sql = mysql_query("select * from users u left join websites w on(u.userid = w.userid)"); $users = array(); while($row = mysql_fetch_assoc($sql)){ $users[$row['userid']][] = $row; } print_r($users); ?>
-
why are you making a table for each person?
-
Here is some code I just wrote
<?php function jpgThumb($orig_file, $save_file, $thumb_width, $quality = 75){ // Create a copy of the original image and save it into memory for later manipulation $main = imagecreatefromjpeg($orig_file); // Calculate the thumbnail's height/width based off the original images' height/width $info = getimagesize($orig_file); $width = $info[0]; $height = $info[1]; $new_height = $height * ($thumb_width / $width); // Create a blank thumbnail with our new height and width $thumb = imagecreatetruecolor($thumb_width, $new_height); // Resize the main image and place it on the thumbnail from the previous line. imagecopyresampled($thumb, $main, 0, 0, 0, 0, $thumb_width, $new_height, $width, $height); // Save the image thumbnail imagejpeg($thumb, $save_file, $quality); } jpgThumb("CapCom.jpg", "thumbs/CapCom.100.jpg", 100); jpgThumb("CapCom.jpg", "thumbs/CapCom.200.jpg", 200); ?>
If you read though my comments above, it is fairly simple to create a thumb based on a jpeg. If you modify it, you can also work with png's (with alpha support) and gif's (with transparency support).
-
Oops, my mistake forgot to add quotes around the $1
-
My regexp has an error, and I can't figure out where it is coming from.
Parse error: syntax error, unexpected '.' in /home/ryannaddy/tutorials.phpsnips.com/incl/classes/Main.inc.php(87) : regexp code on line 1
$string = preg_replace("/\[code\](.+)\[\/code\]/isUe", "'<span class=\"exampletxt\">EXAMPLE:</span><div class=\"code\">'.str_replace('<br />','',$1).'</div>';", $string);
How would I fix that?
-
I have the following function to format some code, I am having a problem though. between the code and example bbc tags new lines are converted to br's. I can't remember how to stop that from happening between those two tags, but do it everywhere else, can someone refresh my memory?
My Attempt:
public function format($string){ $string = preg_replace("/\<\?php.+\?\>/isUe", "highlight_string(str_replace('\\\"', '\"', '$0'), true);", $string); $string = preg_replace("/\[code\](.+)\[\/code\]/isU", "<span class='exampletxt'>EXAMPLE:</span><div class='code'>$1</div>", $string); $string = preg_replace("/\[example=(.+)\](.+)\[\/example\]/isUe", "html_entity_decode('$2');", $string); $string = preg_replace('/(<br\s*\/*>)/is', '', $string); $string = nl2br($string); return trim($string); }
Thanks!
-
Thanks!
live() works! I would rather not have to rebuild so I will go wit that one.
-
I am using jQuery and I have a drop down menu and when a user select the option "New Option" a text box is un-hidden they enter the new option, and press add. jQuery I send the value of the textbox to a php file which adds the option to the database, then I have a php function which rebuilds the drop down with the new value in it and the hidden box. I then add those to the page (over writing the old drop down and hidden textbox).
The problem I am having is that I can do this one time the second time this no longer works unless I reload the page. What is causing this?
-
I have a div that I made editable, and when you select the text and click the "code" link, I would like to place bbc around the selected text, much like the buttons here.
what is the best way to do that?
-
I widthdraw my previous post with a quicker way:
select sec_to_time(sum(time_to_sec(the_time))) as total_time from test;
this will return something like:
120:20:13
if you want seconds, remove the sec_to_time function.
-
This works for me (result is in seconds):
select sum((hour(the_time) * 60 * 60) + (minute(the_time) * 60) + (second(the_time))) as seconds from test;
Networking for web server
in Miscellaneous
Posted
I have more than one computer, and I would like to network them for my website, what is the best way to this? One of the computers doesn't have an Ethernet port, the other 2 do.
I have never done this before, so any help would be nice!
Thanks.