-
custom function causes use of undefined constant
Have you tried testing your mysql query in something like mysql workbench or phpmyadmin? I have a feeling you don't need the single quotes around the $arg variables in the query statement.
-
guestbook for my webpage
If you want something quick your best bet is to google around for something pre built to slot in. The question is actually how much you want to learn and put into learning and how much you are already know. If you know about programming you can skip the initial chapters and start with the ones on MySQL. You can try diving straight into one of the example chapters and then go back to the chapters that cover any bits you don't understand. The good thing about this book is every chapter teaches you new concepts and techniques and new php functions.
-
guestbook for my webpage
To create a guestbook which stores the data in a database you will need to learn a database design, a database language such as MySQL and a server side language such as PHP. There are loads of online tutorials as well as books to teach you what you need to know and many have associated forums. I second what D4YO said about being careful of which ones you follow. Look for newer ones that use the newer mysqli extension or PDO class as older ones use functions that are deprecated and soon to be removed from the support list. I've found Larry Ulllman's books very good - you could probably start with PHP and MySQL for Dynamic Websites. At the end of that book you will definitely be able to build what you want and a whole lot more.
-
What is Key and value pair in web programming
In what context? In an array, the key is the name or index of the element and the value is what is stored in that element. You use the key to access the value. For example using a numerically indexed array $days = array(1=>'Monday', 'Tuesday','Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'); echo '<p>the 6th day of the week is ' . $days[6] . '</p>'; and for an associative array $person=array('fname'=> 'John', 'lname'=>'Smith', 'email'=>'johnsmith@aol.com', 'nationality'=>'American'); echo $person['fname'] . ' is ' . $person['nationality'];
-
Open Link In New Window
In your a tag, you could include the target="blank" parameter.
-
Convert Date (String) to new Date Format
mysql has a date_format function which converts the date directly, I'm not sure if mssql has a similar function. PHP has a bunch of date/time functions - you can look them up in the php manual. I think you'll need to convert the date to a unix timestamp and then convert it to your required format. Assuming $date is the date you've retrieved, you could do something like $formatted = strftime('%Y-%m-%d %H:%M:%S', strtotime($date));
-
-
PHP to echo out files as files
The reason you're not getting the error on line 116 anymore is because I fixed your code but you haven't sorted the single/double quotes. Single quotes displays everything literally, double quotes substitutes the value in place of the variable. echo '$thumbs'; will output $thumbs echo "$thumbs"; will output thumbnails Use the code I supplied, run it in your browser and look at the source code. If the images don't appear its because your file structure is in error. Do you really need the paragraphs because there's alot wrong with that bit of code. If you do need it, learn about arrays and offsets and how to access individual elements in an array.
-
PHP to echo out files as files
Which is line 116? The line below has the single and double quotes mixed up and some syntax errors: echo ' <div class=\"galleryItem\"> \"<a class=\"fancybox\" rel=\"group\" href=\"images/$base/$file\"><img src=\"$base/$thumbs/$file\" alt=\"\"/></a>"; </div>' try changing it to echo " <div class=\"galleryItem\"> <a class=\"fancybox\" rel=\"group\" href=\"images/$base/$file\"><img src=\"$base/$thumbs/$file\" alt=\"\"/></a> </div>"; Is $paragraph defined as an array earlier on? otherwise this line will fail if ($paragraph[$i]) See if the above helps, otherwise could you be more specific about the error you're getting.
-
Create pages for users when they register
You will need to add a mod_rewrite rule to your .htaccess file. It looks more complicated than it actually is. There are various online tutorials which will explain the concept and technique.
-
-
Help with Php Signup Form!?
The tutorial referenced is a decent starting place to give you an overview of what is required to process a form, validate the data, insert to a d/b and send an email but it is nearly 4 years old and using deprecated functions. First and foremost - don't use the mysql functions, PHP 5.5 is now out and soon mysql functions will not be supported. Learn the mysqli extension or even better learn the PDO class. Since you're new to this, you might as well learn techniques which have a future. Secondly, look up PHP's filter functions for validation. They are more secure and make validation easy, particularly email addresses and urls. You can find these functions and a lot more in the php manual. If you have any specific questions on any of these functions, post them here.
-
-
PHP - News article page info grab from template?
You need a way to programmatically let news.php know which article to display. One way is to append the id of the particular article in the url e.g. news.php?id=1. news.php can access the id via $_GET. How/where will your site do this? Setting up and accessing a database is not difficult but will require a little learning. If you data is complicated designing the d/b can be challenging but if you just require a table for your articles, it is straightforward. The alternative is to learn the php functions to get and retrieve data from another file. Finally if you want nice urls like news.php/article1 as opposed to urls like news.php?id=1, you will need to include some mod_rewrite rules in your .htaccess file. Again this is not too difficult but will require some more learning.
-
-
-
PHP - News article page info grab from template?
if I understand what you are trying to do, you basically need to code up your own template and insert the article. Will you be storing your articles in a database? Your news.php script will be structured something like this <?php include('header.html'); include('sidebar.html'); //get article from database // display article include('footer.html'); ?> If you have a list of article titles on another page and you want to link to the full article, your a tag should reference the above page along with the id of the article. <h2>Recent Articles</h2> <ul> <li><a href="news.php?id=1">Title of Article 1</a></li> <li><a href="news.php?id=2">Title of Article 2</a></li> <li><a href="news.php?id=3">Title of Article 3</a></li> </ul> At the top of news.php you will access the id of the article using the $_GET global. $id = (isset($_GET['id']) && ctype_digit($_GET['id'])) ? $_GET['id'] : false; This is a ternary statement which is a succinct if else statement made up of the following 3 parts: (isset($_GET['id']) && ctype_digit($_GET['id'])) says if $_GET['id'] exists and is of type integer; ? $_GET['id'] says if the if statement is true set $id equal to $_GET['id']; : false - is the else part of the if statement - if the if statement is false set $id equal to false; news.php can then check if $id is false and do some error processing otherwise get the article from the database using $id
-
-
baseURL - php include code from seperate document
One way is to have a config file (config.inc.php) that is included by all scripts that will define all your helper functions and site constants. In that file define your base url and base uri constants define ('BASE_URI', '/home/example/'); //remote path to root folder define ('BASE_URL', 'http://www.example.com/'); //live url //define ('BASE_URI', '/Applications/MAMP/htdocs/example/'); //local path to root folder //define ('BASE_URL', 'localhost/example/');//local url Then your include can be something like include(BASE_URI . 'assets/subbar.php'); Be sure to comment / uncomment out the 2 lines depending on whether you're working locally or remotely
-
-
Contact form php script build.. help?
You really want to do some validation on the form data. Look up php's filter_var - it makes validating email addresses easy. You will also want to ensure that your required fields are filled in, do some anti-spam processing and display helpful error messages. Look up htmlspecialchars() and strip_tags(). As coded, you won't get the expected results because you've used $_POST['email'] and $_POST['email_address']. $_POST['email'] will never exist the way you've coded your form. One other thing, its bad form to use uppercase for variables.
- NEED HELP! Contact From PHP