premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
[SOLVED] help with uploading a file and inserting file info to db
premiso replied to ROCKINDANO's topic in PHP Coding Help
You would need to enter that into the DB, you currently are not. So in the file upload script enter it there, you may have to modify your DB to accept a new column filename. To clarify further, this would be your insert statement: $query= "INSERT INTO ccagenda VALUES (null,'{$adate}','{$link}', '{$file['name']}')"; -
[SOLVED] help with uploading a file and inserting file info to db
premiso replied to ROCKINDANO's topic in PHP Coding Help
print "path: ".$file['tmp_name']. "<br />"; print "name: ".$file['name']."<br />"; print "type: ".$file['type']."<br />"; print "size: ".$file['size']."<br />"; print "error: ".$file['error']."<br />"; Are you not already doing that? the $file['name'] is what that file name was when it was uploaded.... -
[SOLVED] help with uploading a file and inserting file info to db
premiso replied to ROCKINDANO's topic in PHP Coding Help
You can, or you can pull it out from $_FILES. Whichever you prefer, but you will need it to access it later. -
lol you know what they say? Great minds think a like lol. To be honest, whenever you beat me to the punch I think the same thing, "Damn, he wrote what I was going to" and generally discard my post lol.
-
You are not doing a while loop to loop through the data... <?php $query="SELECT mem_username AS username FROM members WHERE logged_in=1 ORDER BY mem_username ASC"; $result=mysql_query($query) or die(mysql_error()); $usernames = array(); while ($row=mysql_fetch_array($result)) { $usernames[] = $row['username']; } $usernames=join(", ",$usernames); echo "$usernames"; ?> Should work.
-
[SOLVED] help with uploading a file and inserting file info to db
premiso replied to ROCKINDANO's topic in PHP Coding Help
Well here are a few issues that I see. A. You do not send the filename to the DB. If you did you could just query the DB and pull out the filename and use that in place of ?agenda_id. B. It is hard to disregard that info I requested, because the real question is, what is suppose to be contained in "link" in the DB? Why is that there? You seem to be missing a few steps that are crucial, such as the actual file name stored in the db. -
That usually means your recursive loop never exits, it just keeps looping itself. Check your logic and make sure it that it exits and does not just keep going and going and going.
-
[SOLVED] help with uploading a file and inserting file info to db
premiso replied to ROCKINDANO's topic in PHP Coding Help
Does it not work? From the looks of it you have the link there with the date, but your link slashes are backwards they need to be / If that does not help, post on what is not working about it? Are you sure the index file under citysect is working properly? or does there actually need to be a different file name that it should point to? -
[SOLVED] Need Help Modifying preg_match to Prevent Only Spaces
premiso replied to limitphp's topic in PHP Coding Help
Not sure if trim would work, but give that a try. That should trim any leftover white spaces. I do not know if it will just remove the beginning and end and still leave 1. empty may also be an alternative to use. -
array_unshift The return value of array_unshift Yes you could get it from sizeof, but why? There is no need to when it is being returned like that. <edit> The good it does to return that instead of sizeof to know that your elements were added. You can do a check to verify. The array is modified on it's own since it is essentially passed by reference, thus there is no need to return the array cause it is modified without doing that. And the manual does not state the output to be an array: Int is not an array, it is a number. </edit> <?php $array = array("apple", "cherry"); $newcount = array_unshift($array, "banna", "kiwi"); echo "The new array count is: $newcount <br /><br />"; print_r($array); ?> Should print 4 then the array.
-
[SOLVED] help with uploading a file and inserting file info to db
premiso replied to ROCKINDANO's topic in PHP Coding Help
$agenda_id=$_POST["agenda_id"]; $adate=$_POST["adate"]; $link=$_POST["link"]; Where is that post data coming from? I do not see it anywhere on the form. Is there a reason why you would want to use a passed in date instead of just using NOW() in the MySQL insert? -
[SOLVED] Need Help Modifying preg_match to Prevent Only Spaces
premiso replied to limitphp's topic in PHP Coding Help
I do not think this can be done all in one, nor should it. You want to tell the user why the security answer is invalid so they can fix it. I would save the check you have right now for the end then add a check just for the spaces, for the numbers and for the letters. If it is just all spaces then you return false with that error. If it is just all numbers, same thing etc etc. Work at it like that and see what you cannot come up with. Spaces are fine in a security answer some people remember phrases more than a word. -
Post the full script and I will take a look. Other than that I do not know. The query works with my data on my server, why it does not work on yours I have no clue.
-
I bet the issue lies within the dbQuery function and how it is handling the passed in data. I do not know how it works, but try this and see if this works: $c = mysql_query("SELECT * FROM customers WHERE $where"); My spider senses says it will because I bet the %1 assumes that there is a colname = %1 which it then adds single quotes which would cause a mysql error.
-
Do some debugging. $where = implode(' AND ', $where); echo $where; // echo where here. $c = dbQuery("SELECT * FROM customers WHERE %1", $where); $customer = mysql_fetch_assoc($results[$c]); See that the WHERE is generating like it should. Also check to see if there is an error like this: $where = implode(' AND ', $where); $c = dbQuery("SELECT * FROM customers WHERE %1", $where); if (!empty(mysql_error())) { die('SQL Error: ' . mysql_error() . ' USING WHERE CLAUSE: ' . $where); } $customer = mysql_fetch_assoc($results[$c]); And see where that gets you. Also verify that using the WHERE clause that is printed that there is data in the DB with those parameters set. Also change the <? to <?php as short tags may be the problem: <td colspan=3><input type="text" readonly=true style="width:200px" name="FirstName" value="<?php echo $customer['first_name']; ?>"/>
-
You have a duplicate <?php in that code. <?php include 'common.php'; dbConnect(); // <?php remove this php here and it should work.
-
<?php $where = array(); $_POST['LastName'] = "bob"; $where[] = isset($_POST['LastName']) ? " `last_name` = '". mysql_real_escape_string($_POST['LastName']) . "' ":null; $where[] = isset($_POST['State']) ? " `states` = '" . mysql_real_escape_string($_POST['State']) . "' ":null; foreach ($where as $index => $val) { if (is_null($where[$index])) unset($where[$index]); } $where = implode(' AND ', $where); echo $where . "<br />"; $c = "SELECT * FROM customers WHERE $where"; echo $c; die(); ?> When I run that this is what is returned: `last_name` = 'bob' SELECT * FROM customers WHERE `last_name` = 'bob' So I am not sure why yours would not work. Can you elaborate on how it did not work?
-
Then you need to do some query creating: <?php $where = array(); $where[] = isset($_POST['LastName']) ? " `last_name` = '". mysql_real_escape_string($_POST['LastName']) . "' ":null; $where[] = isset($_POST['State']) ? " `states` = '" . mysql_real_escape_string($_POST['State']) . "' ":null; foreach ($where as $index => $val) { if (is_null($where[$index])) unset($where[$index]); } $where = implode(' AND ', $where); $c = dbQuery("SELECT * FROM customers WHERE %1", $where); ?> That will generate a dynamic where and you can easily add more conditions like shown above.
-
http://www.totallyphp.co.uk/code/convert_links_into_clickable_hyperlinks.htm Granted it uses ereg instead of preg, but it will work till PHP 6 goes into production for you.
-
$c = dbQuery("SELECT * FROM customers WHERE last_name= %1 OR states=%2", $_POST['LastName'], $_POST['State']); You said it, OR. Oh and the <code> replace the < with [ and the > with ]
-
print_r($parsed); That is what I wanted a print_r on, but it is not being set. What type of a URL are you passing to the function? What version of PHP are you using? It seems to me like the url may be causing problems, but I am not sure. Let me know on that and We will go from there.
-
Maybe 100 years ago, but now they use numbers just like everywhere else Maybe I said it wrong, they use non-english characters for the separators in dates, which can be seen in what he posted earlier that is being passed to strtotime...
-
strtotime It has to be english, chances are the other languages kept the numbers, where as Japanese uses characters for the numbers, thus strtotime will not work if the time has already been converted to Japanese. Simple as that.
-
lol my bad, been a long day and my mind is going to the pits and creating stuff that is not there ....damn those gremlins in my keyboard..... EDIT: Change mchl to haku in the above post...I knew I saw that somewhere on here! EDIT: EDIT: Thinking along mchl's line, why do you care if it is stored in the DB as Japanese time, store it as regular time then on page display use the strftime and display it as Japanese....I finally got what mchl was trying to say
-
I highly doubt the unlimited bandwidth, I am sure they have a clause in there on what that actually means, same with HDD space. I bet the fine print has restrictions on what that actually means, like mchl said maybe they limit the queries per hour. Cause I pay around $1200/month for a dedicated server and I have bandwidth and hdd limits. Granted my bandwidth is about 3,000 gb/month and I have yet to come close to it, I still have limits for that price. But I also get 16 ips on my server to use for my customers sites, but yea. Dedicated hosting is extremely pricey, but is totally worth it for security and the fact that you do not have to worry about some knot head taking down the server or them erasing your account for no reason etc. I totally understand the costs to run a free site on a dedicated server. Anyhelp you can give is a big help to keep the site up and running.