Create address link from database row query [closed] - php

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 5 years ago.
Improve this question
I would like to ask if anyone have any useful tips for a problem I'm having.
I have table in my database that looks like this:
row_Id unique_ID Name Info Etc...
1 5004007 Alice Doctor
2 6402305 Thomas Actor
I am trying to have an address link that will look something like:
http://mywebsite/ppl/5004007 - site with this link would echo values from row #1
http://mywebsite/ppl/6402305 - would echo values from row #2
And so on.
Can anyone help me please?
Here what I have so far:
<?php
include "./connect.php";
$result = MySQL_DB_Query($ac_db,"SELECT artists_id_gg FROM ivgdb_artists WHERE artists_id_gg = 1001001");
// $unique_link = MySQL_Num_Rows($result);
echo "<a target=\"_new\" href=\"mywebsite/ppl/"; . $result "\">This is the link to the page with that row's info.</a>";
?>
Shoud be something along the lines: ;
but with informations pulled from that table's row

if you change your link to like this :
http://mywebsite/ppl/unique_ID=5004007
you get a variable in php using this
$unique=$_GET["unique_ID"];
edit:
your link must be
http://mywebsite/ppl/?unique_ID=5004007
thanks -rtfm

Related

How to select specific text from quotes in SQL [closed]

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 3 years ago.
Improve this question
I want to get values from the other rows by selecting a specifc text from the quotes from items row
Image:
I tried all the ways I've know but nothing of them working.. example
$this->f3->get('DB')->exec('select tops.id, tops.name, tops.img from tops where tops.items = 1 ');
So what I want I want to select that "1" or "2" from items row ( check the image )
If the row you show in the image is an example of what you are attempting to select, then the SQL string you should be using would be:
'select tops.id, tops.name, tops.img from tops where (tops.items like \'%"1":%\' or tops.items like \'%"2":%\');'
This will select rows where the tops.items column contains either "1": or "2":. If you are trying to match something else, then please try to be a bit clearer in your question.

display result from 2 table [closed]

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 4 years ago.
Improve this question
I am working for small project, the main idea of the project to display
some tours:
DB - Database consist of 2 table like below
The first table consist of 4 raw:
id , tour_id , tour_name, image
and the second table for each tour details like destination and places
and raw is:
id , tour_id , from , to
The main page is done, I can display information of tour with images and url link to details page like www.domain.com/tours/get_tour?=1
where 1 is the tour_id.
My question is how can I show the information from the second table with respect tour_id?
I am working in PHP and HTML and MYSQL.
You need JOIN function of mysql. The use this type of SQL script with PHP:
$sql="SELECT first.tour_id, first.tour_image, second.tour_id
FROM first
JOIN second ON first.tour_id=second.tour_id;";
$results=$conn-->$sql; //with $conn your connection variable
$get_tour = $result->fetch_assoc();
In this way you can get first.tour_name and second.from/to depending on tour_id
Then run a while to export your datas in PHP.
$get_tour is now populated. To call elements, use
$get_tour['first.tour_id'];
$get_tour['second.from'];
...
Let me know if it works!

How to implement a next button for a forum in php? [closed]

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
Currently trying to implement a next button that would take you to the next topic in a forum but I have no idea where to start.
Assuming the forum is constantly updated in terms of the time of the last post.
If they have an autoincrementing primary key in the database, you could get the current ID, bump it and create a link pointing to the next one (provided you do a quick check to make sure its valid, e.g., the next post wasn't deleted previously).
EDIT: If the forums are sorted by last update (and you want the "next" post to mean the next most recently updated, then you'll need to do a little querying.
$sql = "SELECT postID, postName FROM forum_posts WHERE last_updated < '$thisPostsLastUpdate' ORDER BY last_updated DESC LIMIT 1";
$result = mysqli_query( $dbconn , $sql );
$fetch = $result->fetch_array();
$fetch should contain the array of values you want (the ID for generating a link to the next post and postName as the link's text).

How to view all fields in a database after clicking one data [closed]

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 8 years ago.
Improve this question
Sorry I could not find words to describe my issue. May be you will understand.
Tools: PHP & MySQL
I have created a database with fields: CID, Name, DOB, Gender, EmailID.
Data: 01, Kunal, 18.10.1988, Male, kunal#abc.com
I am able to display all/one data as required in a table.
Example: Suppose I display only CID and Name.
What i want: I would click on CID and it will show all informations(CID, Name, DOB, Gender, EmailID) in another new page with an option "ok".
Please suggest!!!
Regards,
Sourav
Hi, I am very new. I am not getting any clue. Can anyone help me with example (full source code). Say One page would just show CID and when clicked on the CID (say 1) it will open a new page with all information. Please anyone can help me.
That's simple...
You create a table and you can fetch data with two simple query.
First , you should set the CID field as PrimaryKey.
Then, for creating links:
$query = "SELECT `CID`,`name` FROM `your_table`";
With this query result and a loop, you can make links with this format:
...
In second_page.php you should do like this:
$cid = $_GET['id'];
$query = "SELECT * FROM `your_table` WHERE `CID`='". $cid ."'";
With second query you get one row of your_table.
If you newbie in MySql , first see:
http://www.w3schools.com/php/php_mysql_intro.asp

Combine Two Column Fields From ONE Table [closed]

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 8 years ago.
Improve this question
I made a new question cause I don't understand the other answers.
I want to get clear here.
I have a table named "experiences".
It has THREE FIELDS: id, experience_name, years.
I want to combine the TWO COLUMNS : experience_name and year and name it like.. experience
Then i want to make a new table and name it resume_experiences and put the COLUMNS id and experience
can you guys please help me..
How am i gonna do it?
OUTPUT SHOULD BE:
table name: resume_experiences
fields: ID | EXPERIENCE
Try this:
INSERT INTO resume_experiences
(id, experience)
SELECT id, CONCAT(experience_name, ' ', CONVERT(years,UNSIGNED))
FROM experiences
CREATE TABLE IF NOT EXISTS `resume_experiences `
SELECT `id`, CONCAT(`experience_name`, ' ', `years`) AS `experience`
FROM `experiences`;

Categories