Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a database of store names, and I want to make it possible that each store has its own personal page.
Would I have to make a separate page for each store or is there a way to have a single page that works as a template that when the user clicks on the store name the information just changes according to the store name.
If so could someone please set me in the right direction.
Thank you very much.
Yes, its possible to do this:
<?php
$store = 'abc'; // here make $store equal the store name out from the database
echo "Welcome to ".$store."'s store!";
?>
You could include further items, or even have images from the stores folder by using the $store variable as well. For example, to show the logo you could do the following:
<?php
echo "<img src=\"http://www.domain.com/".$store."/logo.jpg\">";
?>
At the end of the day, it depends how complex you want it. But as others will say, you'd better learn some of PHP's functionality and database features so you can get the result that you need.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Yes, i looked for this question online, but I can not understand.
For example i know that when you log in you go to a link like :
site.com/Username
I know that you have to have a page for users in general like : user.php
but how exactly you put the name of the person at the account page when log in or the discription(do you read the name from the url and take other data from the database?).
I am new to php.
Please explain me
-Sorry for my english
The Best Way to do it is make a user.php page and when user login in
saves it's all data in session and when user open his profile/or
something else you can retrive data from session like user id and then
use your query to get the specific data against that user
You can store the username/id in $_SESSION['username'] or $_SESSION['id] like this. And can access the data of the user from the username/id. Hope this might help you.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a language system written in PHP. It loads phrases from the database to the array and then displays some of them during the page render. Right now it looks simple:
<h1><?=$phrase['phrase_callsign']?></h1>
What I need is to know, what particular keys was used during the page rendering procedure.
I have a special function to count and log phrases, so code looks like this:
<h1><?=$this->model->phrase('phrase_callsign')?></h1>
What I'm asking for, is there are something already built in in PHP instead of the handwritten function to display array keys used? Personally I haven't found anything yet.
Thanks.
If I understand correctly you want to record the keys you are using to retrieve callsigns from the array. I would just define a regular function where you pass in the callsign. It adds it to another array, logs it, and then return the callsign value.
function getCallsign($callsign) {
// log callsign
array_push($callsigns, $callsign);
return $phrase[$callsign];
}
If you want to make a list of all the callsigns that were displayed, just push them onto a variable:
<h1><?php $all_callsigns[] = $phrase['phrase_callsign']; echo $phrase['phrase_callsign']; ?></h1>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
but did not understand
The concept of generating a link &
more importantly how they save the data in database,do they save it like id of poll & yes/no click or done with other logic.
what will happen to the polls which are expired? will they remain in database or somewhere else?
please help
To handle URL you can use cURL.
But I have an easy method. You can use the concept of Query Strings.
To Create New Question
Store the new question in database.Give Each Question a unique ID.
Then After user submits the questions show him a link like:
http://do-survey.com?question=xzxsa
To store polls
Get question like:
if(isset($_GET['question']))
{
$question = $_GET['question'];
// Now you have the question unique id manipulate the database using this
}
this is not the place to ask such questions, but to make my answer at least remotely useful:
they're not generating a link. That link doesn't exist under the form of a file on the server. Take for example a database containing 'id' 'poll' 'var1' 'var2'.
You can make a php page that gets a param from the link, have it like mysite.com/poll?id=1
The php script will get the '1' as a param, then you SELECT * FROM table WHERE id=1 and you generate the contents via php with the data from the DB.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
My client wants to update content in a website such aa "business opening hours" or other details of their business.
I was wondering whether there is a way to have them update the content without having sql entries for each of the fields and then providing a form for them to update.
Some of this info is hardcoded in a php page per language, as there is a routing script that will choose the corresponding page to pull info from depending on the chosen language.
Example of current info display:
$openingHours = "Our business opens from 9am to 3pm and then evenings from 6pm to 10pm";
$introText = "Welcome to ABCD, where we offer the greatest food in town";
The best would be to enable my client to update the php file but in a user friendly mode, not manual edit. Is there a way?
You can use config.php to make that and on it you can use like above:
<?php
$business = array();
$business['opening'] = 9;
$business['closing'] = 21;
?>
and you can include it and use on whereever u want. (Or u can make that config file via ini. But php is easier)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I just want anyone to correct me if I'm wrong. Can I create a CMS by making a file where you log in as an admin and then you can write an article and send it to a database table. In another file display all articles from the table with ORDER BY id. To delete you simply make a delete script. Do I have to use any other languages like xml or something? Thanks!
The question: Can I make a simple cms by just using PHP and HTML?
No, you don't need other languages.
PHP and MySQL should be sufficient.
Well, the way the articles are displayed depends of HTML, CSS or JS codes you use.
I'm not quite sure what you're asking exactly. But you could easily write something like that in just PHP and HTML, and use a database to store the information.