WatsonN
-
Posts
227 -
Joined
-
Last visited
Posts posted by WatsonN
-
-
Setup a cron job on the server.
-
@scootstah Thank you very much for explaining that.
I agree, but if mysqli is better I'll be glad to use it. It gives me a reason to make new stuff and play with my old code.I was quite happy having gotten the grasp of the mysql functions
-
I have the same question, I have always used MySQL but now i'm hearing I should be using MySQLi?
If so, why? What is so much better about this versus the old MySQL? I am simply curious.
Thank you
-
How is the user logged in? Is it a cookie or something, show us your login code.
-
How are staff picks determined? Is there a table just for it or a column in your existing table for it or what?
EDIT: adding missing information.
-
I looked over your code and your form is using POST but all your if statements are wanting a GET, this may be from one of your includes, but that may be part of why it isn't displaying what you want.
-
Use
error_reporting(E_ALL);
to check whats up, your cookie code worked for me. -- I only tested the setcookies
-
What exactly are you trying to achieve, I'm lost?
I also noticed you said the second box doesn't work, it is most likely because it's the exact same thing as the first one and using the exact same MySQL query.
-
You could create a new page for each or you could put all your pages into a SQL database and use the GET or POST to call a certain row into the page.
-
I'm not sure how your page is set up but if your pulling the image by page id you could use GET or POST for the image name.
-
If you do it the way you are doing it, via the address bar, I would use custom names instead the file name.
If you don't someone could call a filename and load one.
You are not losing Google juice from doing that
I personally include the header and footer but you can do it either way, it won't make a difference to the user.
-
I would seriously consider changing your username and password for your SQL server.
Also, did you mean retrieve the votes, because it looks as if the submit code is there already?
-
<?php
if($_GET['action'] == "add"{
/*Do stuff*/
}
?>
-
Echo out the content before and after trim where you think everything is being deleted and see what you can tell.
I'm sorry, but I'm not doing it all for you, but I 'm more than glad to help
-
You can use mysql_real_escape_string() to prevent injections from user content.
http://php.net/manual/en/function.mysql-real-escape-string.php
A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned. If link_identifier isn't defined, the last MySQL connection is used.
Note:
If magic_quotes_gpc is enabled, first apply stripslashes() to the data. Using this function on data which has already been escaped will escape the data twice.
Note:
If this function is not used to escape data, the query is vulnerable to SQL Injection Attacks.
Note: mysql_real_escape_string() does not escape % and _. These are wildcards in MySQL if combined with LIKE, GRANT, or REVOKE
EDIT: added notes
-
That is one of the first things I did. That's a pretty normal step in the beginning of my debugging process and should be of any experienced developer in my opinion, but thanks for the help!
Just covering the basics
-
What you need to do is on the server make sure all the files are where the page is looking and that it can be opened by the script
-
Were you able to make this a working solution or do you still need help with an issue?
-
Now that that is figured out, what is the best way to go about this once the foreach is opened?
I read the manual and all the user comments and I couldn't find something like I needed.
-
Yep, I messed that one up.
I tried to take a post from a diffrent thread and it was something like this:
foreach($_POST['resource_from_label'] as $key => $value) { $quantity = (!empty($_POST['quantity'][$key])) ? intval($_POST['quantity'][$key]) : 0; if($quantity > 0) { $arr[] = "('$value','$quantity')"; } } $arr_to_string = 'Item, quantity ' . implode(' , ',$arr); echo $arr_to_string;
But now looking at it his second was quantity and was a number not an actual text value
The post I found: "What is the easiest way to make this function"
-
@sunfighter to insert it into a DB
@sasa artist is not numeric
The form:
<form name="Songs" id="Songs" method="post" action="testpost.php"> <div id="form"> <div class="grid_5"> <input type="text" name="Title[]" /> </div> <div class="grid_5"> <input type="text" name="Artist[]" /> </div> <div class="grid_5"> <input type="text" name="Album[]" /> </div> </div> <div class="grid_16"> <input type="button" value="Add 5 more rows" onClick="addInput('form');"> <input type="submit" value="Submit">
And it will expand as needed up to 200 rows
-
I knew I was over thinking it. Thank you.
I also right after posting realized i used & instead of AND, Getting lazy. . .
-
I have a DB INSERT in a script and that works just fine, The problem is that I can't figure out how to get the ID for that entry I just added. I tried using a combonation of SELECT and mysql_fetch_row and a few other varaitions but I can't get to get the data I need.
$PostedID = mysql_query("SELECT ID FROM Playlists WHERE `UID` = '{$_SESSION['ID']}' & `Title` = '{$Title}' & `Description` = '{$Description}' & `delete` = '0'"); $POSTid = mysql_fetch_row($PostedID);
Here is the INSERT that I used
mysql_query("INSERT INTO `Playlists` (`UID`, `Title`, `Description`, `date`, `Author`) VALUES ('{$_SESSION['ID']}', '{$Title}', '{$Description}', NOW(), '{$_SESSION['UID']}')") or die(mysql_error());
I know the SESSION variables look backwards but I promise they aren't
I'm just not sure what it would take to get this to return correctly
-
I'm working on a dynamically expanding form and that works just fine, for now.
I searched the forums and the manual and can't figure out how to make this work right.
There are three fields Title Artist and Album. That submits into a form and then needs to be put into a database.
The problem is, I don't know how to correctly form the loop to do it.
I tried variations of
foreach($_POST['Title'] as $key => $Title) { foreach($_POST['Artist'] as $key => $Artist) { foreach($_POST['Album'] as $key => $Album) { } } }
and
foreach($_POST['Title'] as $key => $value) { if( !empty($_POST['Artist'][$key]) ){ $Artist = intval($_POST['Artist'][$key]); }else{ $Artist = 0; } if( !empty($_POST['Album'][$key]) ){ $Album = intval($_POST['Album'][$key]); }else{ $Album = 0; } if($Artist > 0) { $arr[] = "('$value','$Artist','$Album')"; } }
But I can't get it to a usable state. Any ideas or something I might have missed?
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\xam
in PHP Coding Help
Posted
I know you need to escape your quotes in the HTML
Should work