-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
[SOLVED] Having the Server Run a PHP Script
mikesta707 replied to mikesta707's topic in PHP Coding Help
awesome thank you so much, that is an amazing idea now as far as this Cron job thing goes, what exactly is it? is it a specific function, or should I google it to get a good tutorial on it? thanks in advanced! -
so you want multiple input text boxes where your user can input different email addresses to send the same message? well im assuming you can make the html page with the form. WHen you submit, and go to a php page do something like <?php $email1 = $_POST['Email1']; $email2 = $_POST['Email2']; //etc, make as many vars as you need //now put these variables into an array $email_array = array($email1, email2, etc...); //send the emails to each foreach($email_array as $email){ //your email script here. use $email variable as the to setting } ?> hope that helps
-
Hello everyone. So i created my own discussion board from scratch (its similar to the wakaba image board, but without images.) and it works perfectly! Pretty much exactly like I want, but as it currently stands, there is no way to "bump" a topic, or to cleanse the board (IE start deleting posts once there are too many) Now, I have an idea of what I want to do for bumping a topic. probably something along the lines of having a rank column in the mysql table, and when ever someone posts something, or makes a reply, all the ranks of the topics in the table get changed. Can anyone suggest a better way to do this? if not than thats ok Now the problem I have is cleansing the board. Ideally, I want the server to execute a script, probably once every hour/day or so, which checks how many entries there are, and deletes the ones that have the lowest rank (or.. well highest rank). I want this to be automated, so that I dont have to run the script every time I want this to happen. Is this possible?
-
I assume you want your users to be able to pick who they send an email to? then just make a normal input box... You may want to make some code that validates the input (IE makes sure its an actual email)
-
any other opinions?
-
what i would do in this case (which btw is NOT what your professor said to do) Is make a table in your database with all the photos information, and a table with all the client information. on the photo table, I would have a column with the clients username, or id or something like that to associate a photo with a client. then when they want to view their photos you do something like <? $user = $_SESSION['Username'];//or however you want to get the username $query = mysql_query("SELECT * FROM photo WHERE userid='$user'"); ... //process query etc. ?> I hope that helps
-
Oh ok. well the thing is that the post variable yourfan won't become set unless you.. well.. post the form itself. When the page itself is loaded, the variable $_POST['yourfan'] isn't set, and unless you submit the form to the page again, it won't become set. What i would do, instead of having PHP execute with the onclick event, just set the action to a certain page (like mail.php or something) and put the code you had after onclick in that page.
-
How can you hide PHP tags?
mikesta707 replied to Anxious's topic in Editor Help (PhpStorm, VS Code, etc)
No i dont think there is a way to hide the yellow PHP box in dreamweaver. or at least I have never run into a way (checked around for a while) -
change (isset($_POST['yourfan'])) to if (isset($_POST['yourfan'])) also please dont write in all caps... ever
-
the reason that it wont work is because you have to set a value to the option. instead of <option selected="selected">Please Choose</option> try <option selected="selected" value="choose">Please Choose</option> Then try and see if what matthewJ posted will work
-
variables in user defined functions have a local scope, so the variable you are using to set the title isnt usable by that page. An alternative would be to do make the variables in your function global, IE: <?php function show_form($errors = '') { global $pagetitle= "BLAH BLAH BLAH"; require_once('templates/headTemplate.php'); } show_form(); ?> I believe that would make it so that you could use that variable in your other page.
-
ignore first character and display the rest
mikesta707 replied to sungpeng's topic in PHP Coding Help
the substr() function would probably help you out. This function takes three parameters, the string, the start point and the length, the latter which is optional. If you did the following code $text = "Hello World"; $text = substr($text, 0, 5); echo $text; you would output hello. If you want to take off the first letter, then you want to take the substring starting with the second character right? so the following code: $hello="1 fish meat rice"; $hello = substr($hello, 1); echo $hello; would do what you want because it takes everything from the 2nd character (or the character with position 1) on Hope that helps -
oh lord!!! Dam totally forgot to test in IE. That looks like IE7 or 8 can you tell me which it is? Gah.. it works perfectly fine in FF and Opera too... Thank you a lot for showing me that EDIT: can you give me some info on your PC. what screen resolution are you using specifically. Does it look like that in different browsers for you? I just checked it out in my IE and it looks fine, so I think it might have something to do with your screen size. Do you know any tips for any tutorials for making the CSS change based on screen size?
-
Hey, I recently made a new site aimed at Bassists, and musicians in general. If anyone would give me some feed back on its overall look and feel i would greatly appreciate it. Everything having to do with PHP was hand coded, so If you see any bugs with PHP please let me know also! thank you! EDIT: WOw im stupid. Here is the URL: www.the-under-world.net
-
You may want to use mysql_result instead of fetch_assoc something like the following $result=mysql_query("select * from entrySub order by entryNum asc"); $num = mysql_num_rows($result) $i = 0; while ($i < $num){ $nurseName = mysql_result($result, $i, 'nurseName'); .... etc. } the first parameter of mysql_result is a valid mysql result, the second parameter is the row number of the returned result, and the third parameter is the column name. hope that helped
-
nevermind i fixed it
-
Hey, I can't figure out what is wrong with my code. I have tried a bunch of ways to make the code work, but it doesn't. here is the code: Code: <? $sql = mysql_query("SELECT fid FROM facebook WHERE uid='$user_id'"); if (!$sql) {//test if SQL was valid echo "There was an error"; print mysql_error(); exit(); } $array = mysql_fetch_array($sql, MYSQL_ASSOC);//mysql_assoc because the array doesn't function properly without it $i = 1;// array entry number echo "<h2><fb:name uid='$user_id' possessive='true' useyou='false' /> Stoner Friends</h2><br>";//output. you can ignore this echo sizeof($array) . "<br>";//just to test how big the array is is. foreach ($array as $fid) {//my array loop echo "$i: <fb:name uid='$fid' /><br>"; $i++;//update entry number } ?> by the way the stuff that looks like <fb:xxxx /> is FBML, the markup language used for facebook apps $user_id is set in my config file, and I have even tried making it global. the variable works in every other page i've used it for. I have tried an @ infront of mysql_fetch_array. What should output is: 1. friend 1 2. friend 2 3. friend 3 What it is outputting is: 1. friend 1 It gets the right info for the first entry, but doesn't output the rest of the information on my table. I have no clue why. I have tried different types of loops, different variable combination's, and all sorts of stuff. the SQL validity check runs true, so I don't think the SQL is wrong, plus it returns the first row correctly. I really have no clue why this doesn't work at all. Can anyone else make any sense of my problem? Thanks a lot in advance if anyone can help me or lead me in the right direction.
-
Uploading script. Upload works, but insert into table doesn't
mikesta707 replied to mikesta707's topic in PHP Coding Help
anything? is there something wrong with my code? -
Uploading script. Upload works, but insert into table doesn't
mikesta707 replied to mikesta707's topic in PHP Coding Help
See, i've had the mysql_error uncommented for a while, I just recently commented it out. The thing thats so confusing is that I am getting no errors. Like absolutely fine. I know its not a problem with the upload itself (if there was it wouldn't run the rest of the script, and it wouldnt go to the table) because the stuff appears at the correct place on the server Its really strange, I was looking for what the error was, and it just doesn't come up with one. Hell, i have run what it currently is now, and the mysql_query is returning true because it says that echo statement i have in the if statement. -
Hey, i'm fairly new to PHP ( i have experience with pretty simple databasing stuff) but i recently got my own web server, and on this server I created an upload script. What it does is pretty simple, uploads whatever file into a directory named after the user (ie my directory would be uploads/mikesta707) and this works like a charm however, I also have the script insert some information about the upload into the table (the file size, file type, uploader, etc.) and when i first ran this script, it worked like a charm. Well, after making a few changes (those changes simply being adding a few more variables to insert into the table) the insert stopped working! I really have no clue why. The page isn't giving me any error messages, and its even going so far as to say it is inserting the stuff into the table. well heres my code: <? if (!isset($_SESSION['Username'])) { echo "You can not upload files without logging in, thank you. if you wish to login, go to the <a href='index.php'>main</a> page."; exit(); } //mkdir $uname = strtolower($_SESSION['Username']); if (!file_exists('Uploads/' . $uname)) { mkdir('Uploads/'. $uname); } #These are just the variables that i need for the script $target_path = "Uploads/". $uname . "/"; $file_size = $_FILES['file']['size']; $file_type = $_FILES['file']['type']; $file_aff = $_POST['aff']; $file_type1 = $_POST['type1']; $file_name = $_POST['filename']; $desc = $_POST['desc']; $target_path = $target_path . basename( $_FILES['file']['name']); $_FILES['file']['tmp_name']; if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $insert2 = "INSERT INTO upload SET uploader='$uname', name='$file_name', type='$file_type1', ftype='$file_type', size='$file_size', aff='$file_aff', path='$target_path', desc='$desc'"; mysql_query($insert2); if ($insert2) { echo "Table information entered<br>"; //$err = mysql_error(); //print $err; //exit(); #originally this part went if (!insert, and showed the error, but i commented that out to see if it was just not doing this step and no #saying anything } echo "The file ". basename( $_FILES['file']['name']). " has been uploaded<br>"; echo "The file has been saved as " . $file_name . "<br> uploaded by " . $uname . "<br>"; if (isset($file_aff)){ echo "The creater of this is " . $file_aff . "<br> thank you for submitting this"; } } else{ echo "There was an error uploading the file, please try again!"; echo $_FILES['file']['error']; } ?> What is really confusing me is that im not even getting any errors. When i go to my phpmyadmin page, and see if there are any entries on the table, it just comes out empty. I am seriously lost. Can anyone help?