-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
how is the info stored? ideally you would have the info stored in a db and each row (use) would have a unique id associated with it. You would then select the rows from the database, including the id and loop through each row, displaying your link. Each link url would have the id appended to it, and then the target script would pull the user's info based on the id. Example: $sql = "select user, id from table"; $result = mysql_query($sql); while ($users = mysql_fetch_assoc($result)) { echo "<a href='viewInfo.php?id={$users['id']}'>{$users['user']}</a>"; } viewInfo.php $sql = "select * from table where id='{$_GET['id']}'"; $result = mysql_query($sql); $user = mysql_fetch_assoc($result); print_r($user);
-
well that depends on how they are being stored. If you have a bunch of text files that simply hold a single number at any given time, just do file_put_contents('filename','0'); for each one. However, if that is ALL these files are doing, you could have a single file with a serialized array, or alternatively, individual lines like so: index:0 aboutus:0 etc.. and then loop through each line and reset and write back to the single file.
-
Is it possible to combine these two queries?
.josh replied to advancedfuture's topic in PHP Coding Help
you cannot perform more than 1 full query at a time with mysql_query, however, fyi you are only using 1 db connection to do these two queries. Unless you specifically assign mysql_connect to multiple variables, creating multiple connection resources, and then explicitly specify those diff connection resources in 2nd optional argument of mysql_query, it uses the same connection source. -
$contents = file_get_contents("textfile.txt"); //chose file preg_match_all('~(0-9.]+)$~',$contents,$data); print_r($data);
-
just before your while loop, echo $sql. What is being echoed? My suspicion is your 2nd condition is also evaluating true, which overwrites your $sql in your first condition.
-
greatstar, giving out "better practices" is noble, but of little use to someone who is trying to make something work in the first place. OP: first thing I see wrong is you do not have $physician capitalized in your query string. php variables are case-sensitive.
-
passing a variable to the url in with the serialize function
.josh replied to co.ador's topic in PHP Coding Help
I can't help but wonder whether you are going about this the best way in the first place... How much data are you trying to pass to the next page? If it is substantial, you might wanna consider passing it as a session variable instead of through a query string. Alternatively, pass just an id or something and do the actual query on the target page. Please explain what it is you are trying to accomplish. -
What's The Best Way To Obtain Free Photos For Sites?
.josh replied to phprocker's topic in Miscellaneous
Using 100% free creative in your freelance endeavors is what amateurs do. Yes, lots of people do it. That would be because there are a lot of amateurs out there. -
Are you saying that the image is not showing in IE when the button is clicked? As in, the div style isn't being changed? That code looks okay. Assuming your syntax is right in your button's onclick, there's no reason your code shouldn't work in IE. Did you make sure you have js enabled? What version are you using?
-
help me out: grab the thumbnail of video from any url
.josh replied to jd6th's topic in PHP Coding Help
http://catb.org/~esr/faqs/smart-questions.html -
<3
-
irony ftw
-
you can use whatever you want. It will end up as a 2d array regardless, where $_POST is the top level and then the name you use in the form is the 2nd level. $_POST will always start off on top. So you can do <input type="text" name="price[leg_s]" > <input type="text" name="price[leg_m]" > <input type="text" name="price[leg_1]" > <input type="text" name="price[leg_x1]" > And it is going to start off as for instance: echo $_POST['price']['leg_s']; // echoes whatever user entered into that field if you want to make it $price['leg_s'] etc... simply do $price = $_POST['price'];
-
if you are seeing lots of "==" then you are connecting okay. So then it can only be: a) you said you double checked and you spelled the column names correctly. This is the most common cause of bug. Double check. Make sure you capitalized correctly (case-sensitive!). print_r($row); in the loop to dump out what is in $row b) are you using the right table name? c) are you using the right database?
-
i don't know offhand if there's a built-in function for converting julian date to something else though looking at wiki it looks fairly easy to write a function to convert it yourself. As far as selecting it from the db to begin with: looks like from wikipedia it works more or less same principle as a unix timestamp, as in, greater number == more recent date. So you could easily select x limit 5 desc
-
How to Display Contents of a Txt file, Live.
.josh replied to LAEinc. Creations's topic in PHP Coding Help
a million ajax tuts out there. Just c/p the ajax code onto your page, make the call to the php script. php script would be something like this: <?php echo file_get_contents('textfile.txt'); ?> use javascript's settimeout() to call the ajax function every x seconds. -
..or assign the keys in the form... <form> <input type="text" name="box[leg_s]" > <input type="text" name="box[leg_m]" > <input type="text" name="box[leg_1]" > <input type="text" name="box[leg_x1]" > </form> <?php print_r($_POST['box']); ?>
-
you can use ob_flush. Alternatively, you can make your request via ajax and display your message via javascript.
-
urban dictionary says it means "peeing my pants laughing". I suppose it makes slightly more sense in an "Ending my sentence with a 'lol'" context.
-
And by that what he really means is we assume every random irregular who posts is a moron until proven otherwise. See? We're nice and fair-like.
-
Assignment by reference edited to fix link
-
hmm well after some research, there's no "thin" way to do this. I would suggest you start by looking at the js for <insert forum of your choice here>. For instance, here is the js file for this board: http://www.phpfreaks.com/forums/Themes/default/scripts/script.js?rc2 starting around line 338 function storeCaret(..)
-
oh. I call that a cursor. hmmmm....
-
yes, it is generalized; stereotyped. That would be because while there are some teenagers who do not fit into that category, most do. You know, I personally like being stereotyped. I believe a lot of social time is wasted on figuring out what buttons to push. Being stereotyped makes it easier to figure out what people expect out of you, which in turn, makes it easier for you to either "Ride the clock" or "Raise the bar," depending on what gets you off.