Get A Database Stored Date Echoed On A Website
I'm trying to get a database stored date echoed on a website. The problem is it won't show up. This is the code piece getting the rows:
$row3 = mysql_fetch_array($result);
This is the piece declaring date to $actualdate:
$actualdate = $row3['date'];
This is the piece echoing the date:
echo $actualdate;
I'm sure I'm doing some damn mistake here, it's probably really easy for you other guys to solve.
View Complete Forum Thread with Replies
Related Forum Messages:
Insert Date Into Database, Values Stored As Array
how to insert a date into a database. I have it working where if it is typed into a text field in a form, but i want it to work with a select box. There are 3 select boxes, month, day, and year, and each value is put into the same array. Up at the beginning of my code i have my update and insert querys. Everything works, but i just can't figure out how to get the information from the select box array into the database, it just gives me 0000-00-00, so something is wrong. I guess its just that i dont know how the correct syntax for arrays in the query if i'm using $_POST, since no variables are defined.
View Replies !
Adding Stored Month Value To Stored Date
i have a simple problem where i wish to add a number of months, stores in a database field to another stores value that is a date .data base is MySQL and the date is in YYYY-MM-DD format. The month field is simply a variable, interger 2 digits. I have tried the adddate function in MySQL but it does not seem to take a variable as a interval field.
View Replies !
Templates Stored In Database
I have a form where a user can enter different feild, for simplicities sake, say a 'To:', 'From' and 'Message' feild. The can select a 'template' from the databse, each one has different layouts, images etc, and is sotred as HTML code in the mySql. My question is how do I insert the vairables into the correct places in the template? I realise if it was hard-coded I could use something like: echo "To:". $to. "<br><br>". $message. "<br><br>From:". $from; etc, although this is simplified alot and the ones int databse contain images, tables, css etc. I don't really want to hardcode them using IF statements as I want it to be easy to add new 'templates'.
View Replies !
Displaying Image Stored In Database
The user can browse and upload an image and the image is stored successfully in a seperate binary table (with userid and bin_data, filesize, filename, filetype). The photo is displayed properly when I point my broswer to a script called fileshow.php: PHP Code:
View Replies !
Form Data Not Stored In DataBase
I was trying setting up these scripts following instructions in a book from 2003, so I thought maybe some of the code might be outdated. Basically this is what Is supposed to happen: 1.- Display a form, enter details into fields and click submit. 2.- After having clicked on submit you're redirected to another page that will display the entered values and store them in the MySQL DB specified. Now what happens is that no errors are displayed after clicking on the submit button in the form, but neither are the entered values. In PHPMyAdmin I can see that the Db is still empty. I created a total of 3 files that reside in the same folder: The form, that when clicking on submit is redirected to the next file: Code:
View Replies !
Database-stored Webpage-content?
more and more pages seem to be extracted entirely from a database. Not only dynamic information, like search-engines, but also (semi-)static content, (just text/information) Does anybody know a good tutorial on: how to set up the needed effective structure for these database-driven websites?
View Replies !
Photos Stored In Database Or As Files
I have a question to you. I would like to create photo gallery. I wonder if I should store photos (uploaded by users) in database $data = file_get_contents($_FILES['photo']['tmp_name']); $data = mysql_real_escape_string($data); // Preparing data to be used in MySQL query mysql_query("INSERT INTO {$table} SET ext='$ext', title='$title', data='$data'"); $msg = 'Success: image uploaded' or I should store uploaded photo files as files in the server folder? Few years ago in my previous work I worked in MS Access application, and in my opinion storing photos in this database are not so good, becuase uploaded photo files stored in MS Access application, enlarged the database a few times. That`s why storing such files in database is not so relevant and the better way was to saved these files in the specified folder. What about Mysql?
View Replies !
Viewing Images Stored In A Database
I've written this script which is supposed to take an image uploaded by a user and put it in to a database, then at a later date be able to extract the image from the database and display the image to the user. The problem is that whenever I try to display the image, all I get is an error message that the image contains errors. Can anyone tell me where or why these errors might be coming up? Here is my script (I'm pretty sure it's all there):
View Replies !
Form Data Not Stored In Database ?
This is the code for a Returns form where I am trying to implement these validations: 1. Check if fields aint empty 2. Check if SESSION_username = username from Customer table and get customer ID use that Customer ID to look up Orders table and find if the ORDER NO. that has been entered is = an order no. in the Orders table i.e. see if the oder no. entered was actually an order placed by the user b4 * Customer table has cust id and username. Order table has only cust ID. returns table will store username from Session so that it can display each user's individual returns. Code:
View Replies !
Execute Code Stored In Database
I have HTML code stored in my database fields , i just want to have a script so that whenever that script is called it executes that code as PHP Code.. i am sure your first answer would be eval() but this is a bitt different problem. leme explain. Lets say we have this code <html><head><title><? ShowBodyOfThePage();?> </title></head> <body> <? ShowBodyOfThePage();?> </body> </html> Can any one share his expetise of how we can write a script to which if i send this string "<html><head><title><? ShowTitleOfThePage();?> </title></head> <body> <? ShowBodyOfThePage();?> </body> </html>" it returns to me the same html but with that php function getting executed and replaced with whatever the function returns. Please feel free to advice if the same thing can be done in some other way i mean if for example your method needs to remove "<?>" tags or anything or put this string in any echo.
View Replies !
Using Variable Names Stored In Database Fields.
I'm working on a project where I need to store a CGI query in a database field. The query contains variables which will be substitued at runtime (e.g., today's date, key to select upon, etc), and may be pointed to different URLs depending upon the table key. The variable substitution works fine when hardcoding into the script, e.g.: $var1='data1' $var2='data2' $a="http://www.webserver.com/query.cgi?a=$var1&b=$var2"; $fd=fopen($a,"r"); ... However, the substitution fails when the query is pulled from a database record, e.g. //Only one record returned for testing purposes. // //location field (varchar) is: //"http://www.webserver.com/query.cgi?a=$var1&b=$var2" $var1='data1' $var2='data2' $dbconn=yadda yada; $dbquery=pg_query($dbconn,"select key,location from schema.table"); $row=pg_fetch_assoc($dbquery); $fd=fopen($row['location'],"r"); ... In this case, the variable substitution doesn't occur in the query (i.e., $var1 remains the string $var1, instead of changing into the value of say, ༿-23-2004'). I've tried different variations, and treating as a variable variable (with $$row['url'] and ${$row['url']}.
View Replies !
Resizing Images - How To Use Them On A Database Stored Image.
I am a relative newby to php. I am making some changes to an existing site where the atcual images are all stored in a mysql database. They are called using a script that accesses the database and then displays the image. I need to resize these images on a couple of different pages to various sizes as the stored images are really large. Thumbnail images take as long as the actual file to load. I have found some scripts using the GD library to do this but do not know how to use them on a database stored image.
View Replies !
Header - PDF Files Stored On A Database Issue
I have a few PDF files stored on a database. My client says that firefox doesn't force you to save the file, instead tries to open it, and it's displayed wrong (like a text file full of weird characters). I think this just happens on older versions of Mozilla/firefox, but I think it can be solved. Does anybody know how? I was trying something like: Code: header('Content-Disposition: attachment; filename="' . $id_file . '_' . $file_name[0] . '.pdf"');
View Replies !
Display The Messages (which Are Stored As Rows In A MySQL Database)
I am creating a message board for my website and I want to be able to display the messages (which are stored as rows in a MySQL database) so that it clearly shows if a message is a reply to someone elses message or an original message example of 5 message (3 original posts and 2 replies) post 1 - I like cake! post 2 - Reply to post 1 =>I like cake too! post 3 - Reply to post 2 which is a reply to post 1 =>What sort of cake?? post 4 - Hows the weather? post 5 - Can't think of anything else To distinguish a reply from an original post in my MySQL table i have a column called 'reply' which i fill with the ID number of the post it is reponding to. However this wont tell me if the reffering post is also a reply to another post. Does anyone know a good scalable way of doing this, and printing it on a screen with each reply indented and displayed under its reffering post?
View Replies !
Being Echoed
I have following html before head of html in my page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>
View Replies !
Date Is Not Being Pulled From MYSQL Database, Instead Current Date Is Displayed!
I am having trouble pulling a date from a database using PHP at the <a href="http://www.mytuneslive.com/ameshkin69/"> following page.</a> Here is the code. As you can see, it is just making the date the current time. The values in the database are UNIX timestamp, and the DATE() function is used to convert from UNIX to readable date. Can <td width="55%" align="left" valign="top"><?php $row_comment['timestamp'] = date("n d Y g:i A");.....
View Replies !
HTML Echoed Out
Does anyone have any idea why when I echo HTML it doesn't parse the HTML but outputs the code? I even added two <h2> tags manually and it works, so it's just from pulling it out of the database. PHP Code: <?php //The <h2>s work fine but the array variable being outputted doesn't parse the HTML echo "<h2>".$profile['biography']."</h2>"; ?>
View Replies !
HTML Echoed
I have the notion that everything is more secure if everything is in php, and nothing is in html. Perhaps I am mistaken in my understanding. But, because I believe that everything would be more secure in php, I am trying to take an html form, and find a way to ECHO it in php. It is an example form that I found in google. It works just fine as HTML, and it is a submit to a php script which will receive the data through $POST. But, I am trying to build all the HTML in $form and then echo it. I am not having much success. Code:
View Replies !
Formating Echoed Table
How would I format the table with borders backgrounds etc. printf("<table>"); do { $myrow = pg_fetch_row($result_set,$rows); printf("<tr>"); for ($i=0; $i < $count_ch; $i++) { printf("<td>"); printf($myrow[$i]); printf("</td>"); } printf("</tr>"); $rows++; } while($rows < $rowsnum); }
View Replies !
Last Twelve Hours Echoed
I am so tried but can someone help and show me a basic way to only display the last twelve hours of results from the MySQL? I have a column with the time, how do I only show the last tweleve hours?
View Replies !
Echoed The MySQL Query
I'm currently building a time booking system, and what I have done is created a few tables in my database and populated these with some test data. The problem I'm having is that I know for a fact that when I click on the 1st Sept for example the first couple of time slots have been taken,so for a test I've used the word 'booked', this works, if the time slot is not taken then it should say 'available', this doesn't do it. I have echoed the MySQL query and I've test this on the MySQL console and it works, but yet it says 'booked' when its really not.
View Replies !
Variable In A Php Echoed Form
At the moment it prints " /> and I lose the variable. <?php echo '<form action="formt.php" method="post"> <input type="hidden" name="uname" value="$_SESSION["username"]" /> <input type="submit" label="submit"></form>' ?>
View Replies !
How To Document A Website/database
I've got a fairly complex LAMP database and website that have grown, I'll say, "organically". That is, without much structure or initial planning. I'm finding it hard to keep all the different relationships straight as I continue to develop it. With that in mind I would like to document the project, but I don't have a lot of experience with documenting and charting, etc. (I vaguely remember flowcharts and Gantt diagrams from a brief programming course). I would also like to do this as a visual aid for potential investors. Could someone point me to a good resource for learning about this kind of thing? It's hard to separate the wheat from the chaff when googling. Also, can anyone recommend the types of documents I should be considering and any good programs for making them?
View Replies !
Saving Result Of Function Without Being Echoed
I am trying to save the function "rand(1, 1000000)" in a variable but when I am for example trying: $randomnumber = rand(1, 1000000); it is executing it right ahead while when i try $randomnumber = "rand(1, 1000000)"; or $randomnumber = 'rand(1, 1000000)' It is saving rand(1, 1000000) as variable. But what I need is a variable saving the result of rand(1, 1000000) so the number does not change either. Any ideas how I would do this?
View Replies !
Compare Date Of Today And The Date In The Database
i have a db that stores a date in a table with a specific column. db=test table=test_date_compare column name=date_inserted ok i hv a php form that allows user to input date and it enters in the above column (date) as in format eg: 21/03/2007 now i wat i would like to do is i would like to compare date of today and the date in the database if it is lesser then todays date it deletes that row of data. deleting the row of data i know how but the problem comes wen coparing the date i dunno how to ...
View Replies !
Converting Database Date To Normal Date
I am looking for a way to convert a date that is stored in a MySQL database like this after useing the date() function in PHP: 2006-08-16 21:03:54 and convert it into a date this: 16 August 2006 @ 11:03:54pm Does anyone have some insight as to how I would go about doing that?
View Replies !
Store Date In Mysql Via <?=$row["stored"]?> With If Statement
among other things, i am storing date data in mysql. it is stored as yyyy-mm-dd. i can pull the data and display it via <?=$row["stored"]?> , "stored" being the date. what i want to do if have an if statement that says if "stored" is less than 7 days old, it echoes new.gif. I am fine with regular if statements, but haven't worked with dates much at all.
View Replies !
Creating A Website Tree From Database
I have been given the task of creating a website tree-type diagram. I have details about web pages stored in a MySQL database. There is a reference column in the database using the format: 1.0 1.1 1.1.1 2.0 2.0.1 2.0.2 2.0.2.1 I'm sure you get the gist. What I need to do is loop through these rows in the table, outputting them in their heirarchical structure, turning this into a graphical representation in HTML. This has me confounded from the start. I'm not sure how I would loop through these numbers in the correct order. Also, I'm not sure how I would now when I've got to the next level of numbers e.g. after looping through 1.1 - 1.6 (which should all be in the same row), how I would know that I now need to create a new row for 1.1.1, and that on this row should also be 1.6.1 --- I'm confused just writing it out.
View Replies !
Accessing Session In A Php Page Echoed By Fstream
if I load a php page from controller.php like this: $handle = fopen("http://localhost/MvCphp_1.0/View/maincatgory.php", "rb"); echo stream_get_contents($handle); fclose($handle); then the created session, in the file where I am running the above code, for instance $_Sesssion['hr']='ge'; will not be accessible in echoed file above "maincatgory.php" I don't know why? and I want to know how can I access...?
View Replies !
Exporting Database To Excel (via Website, NOT PhpMyAdmin)?
I know via phpMyAdmin I can export my database in Microsoft Excel 2000 format, and can check a box to 'Create field names as first row', but it doesn't give me the php code used to achieve this. I need to have a page on a website so the administrators will be able to do this for themselves, does anyone know if this is possible?
View Replies !
Database Credentials Should Be In A Private Root On Website
I was reading the "Essential PHP Security" book part of the O'reilly series, and it explains how my database credentials should be in a private root on my website. The only two directories I can see are public_html and public_ftp, and yes I have shared hosting, so I am not sure there is a whole lot I can do about this issue. What are those private roots and why is it better to keep my database information in a separate file instead of my individual php files? when users log in I enable a session variable which is not a username or a password, its a variable which cannot be traced to any specific user, would i need another variable for security purposes say like a user ID variable so each user can be defined as well. I am just concerned about the security of my site.
View Replies !
Database-backed Website W/o Server RDBMS
I'm looking for a website backend. I can use PHP and other scripting languages, but I don't have access to an RDBMS. So I'm looking for an RDBMS substitute -- maybe something that reads/writes plain text or XML files sitting on the web server. Any ideas?
View Replies !
Disadvantages And Advantages Of Database Based Website
I have created a website mostly dependent on MySQL database. What are the disadvantages? Will MySQL be able to serve about 100 to 500 users concurrently? I guess that is my main concern. Will a website based on database be slower or faster than a more traditional webesite where it is maily based on individual files?
View Replies !
How To Create A Hidden Field Variable From An Echoed PHP Figure?
I have a PHP script on a shopping cart summary page that creates an invoice number and then echoes it to the page. This page, when submitted, will go to the shopping cart processor. The echo portion of the script is working properly, it generates the number as intended. My problem is that, not being very experienced in PHP, I want the invoice number not only echoed (which it is doing properly now), but also to populate a value in a hidden field that is submitted to the shopping cart processing page. My question is how do I populate the hidden field with the figure that is now being echoed in the script below? The script that generates and echoes the invoice number is as follows: <?php echo "SA"; //department code echo date ("mdy"); //date generator // begin counter this reads figure from "count_file.txt" if (file_exists('count_file.txt')) { $fil = fopen('count_file.txt', r); $dat = fread($fil, filesize('count_file.txt')); echo $dat+1; fclose($fil); $fil = fopen('count_file.txt', w); fwrite($fil, $dat+1); } else { $fil = fopen('count_file.txt', w); fwrite($fil, 1); echo Ƈ' fclose($fil); } // end counter ?> The hidden field is as follows: <input name="Invoice_Num" type="hidden" id="Invoice_Num" value=" "> I would like the value in the above to reflect the invoice number that is echoed by the above PHP script.
View Replies !
Simple Way Of Implementing Bbcode Into A Php-based Website/database Design?
Can anyone recommend a simple way of implementing bbcode into a php-based website/database design? I'd like the user to be able to enter the data using bbcode's options (simple click and format options without having to know anything about code... like this site has) and have this display in pages when the results are pulled out of the database and displayed in HTML format.
View Replies !
|