How to call out a data using an id from the displayed table?
up vote
0
down vote
favorite
I need to call out a the other data from the database and display it through modal but i cant call out the ID from my html table.
Here's my html table and php for posting some of the data's :
<?php
$connection = mysql_connect('localhost', 'root', ''); //The Blank string is the password
mysql_select_db('ts_php');
$query = "SELECT * FROM job_posted"; //You don't need a ; like you do in SQL
$result = mysql_query($query);
echo "<table class='table'>
<thead>
<th>JOB</th>
<th>STATUS</th>
<th>APPLICATIONS</th>
<th>EDIT</th>
<th>DELETE</th>
</thead>
"; // start a table tag in the HTML
while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results
echo "<tr>
<th>" . $row['job_title'] . "</th>
<td>" . $row['status'] . "</td>
<td>" . $row['applications'] . "</td>
<td><a class='openModal' data-id='".$row['post_ID']."'>edit</a></td>
<td><a href='#'>delete</a></td>
</tr>";
}
echo "</table>"; //Close the table in HTML
?>
And here is my php inside the modal body
<?php
(LINE 121:) $queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
$resultEdit = mysql_query($queryEdit, $connection);
while($row1 = mysql_fetch_array($resultEdit)){
?>
<span>Name:</span> <?php echo $row1['job_title']; ?><br>
<span>loc:</span> <?php echo $row1['location']; ?><br>
<span>job type:</span> <?php echo $row1['job_type']; ?><br>
<span>description:</span> <?php echo $row1['job_desc']; ?><br>
<?php
}
?>
Here is the Execution error
Notice: Array to string conversion in C:xampphtdocstalent_space_phpemployerjobs_posted.php on line 121
PS. I just knew recently that the mysql_* will be depreciated, so im planning to finish this first and then convert into MYSQLI or PDO.
php html mysql
|
show 10 more comments
up vote
0
down vote
favorite
I need to call out a the other data from the database and display it through modal but i cant call out the ID from my html table.
Here's my html table and php for posting some of the data's :
<?php
$connection = mysql_connect('localhost', 'root', ''); //The Blank string is the password
mysql_select_db('ts_php');
$query = "SELECT * FROM job_posted"; //You don't need a ; like you do in SQL
$result = mysql_query($query);
echo "<table class='table'>
<thead>
<th>JOB</th>
<th>STATUS</th>
<th>APPLICATIONS</th>
<th>EDIT</th>
<th>DELETE</th>
</thead>
"; // start a table tag in the HTML
while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results
echo "<tr>
<th>" . $row['job_title'] . "</th>
<td>" . $row['status'] . "</td>
<td>" . $row['applications'] . "</td>
<td><a class='openModal' data-id='".$row['post_ID']."'>edit</a></td>
<td><a href='#'>delete</a></td>
</tr>";
}
echo "</table>"; //Close the table in HTML
?>
And here is my php inside the modal body
<?php
(LINE 121:) $queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
$resultEdit = mysql_query($queryEdit, $connection);
while($row1 = mysql_fetch_array($resultEdit)){
?>
<span>Name:</span> <?php echo $row1['job_title']; ?><br>
<span>loc:</span> <?php echo $row1['location']; ?><br>
<span>job type:</span> <?php echo $row1['job_type']; ?><br>
<span>description:</span> <?php echo $row1['job_desc']; ?><br>
<?php
}
?>
Here is the Execution error
Notice: Array to string conversion in C:xampphtdocstalent_space_phpemployerjobs_posted.php on line 121
PS. I just knew recently that the mysql_* will be depreciated, so im planning to finish this first and then convert into MYSQLI or PDO.
php html mysql
I just knew recently that the mysql_ will be depreciated* It is deprecated and removed in actual php versions
– Jens
Nov 9 at 10:42
2
What is the Problem with your code?
– Jens
Nov 9 at 10:42
But i still can use it... nvm that part. the problem was in the second PHP code, it dont display any result. I think it cant fetch the id from the 1st php code
– Armando Nb.
Nov 9 at 10:44
So is there any other way to fetch the row['ID'] and use it in WHERE id = 'row['ID']'?
– Armando Nb.
Nov 9 at 10:46
print out the Statement and see if it is as expected. Also check for SQL Errors after execution the statement
– Jens
Nov 9 at 10:46
|
show 10 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need to call out a the other data from the database and display it through modal but i cant call out the ID from my html table.
Here's my html table and php for posting some of the data's :
<?php
$connection = mysql_connect('localhost', 'root', ''); //The Blank string is the password
mysql_select_db('ts_php');
$query = "SELECT * FROM job_posted"; //You don't need a ; like you do in SQL
$result = mysql_query($query);
echo "<table class='table'>
<thead>
<th>JOB</th>
<th>STATUS</th>
<th>APPLICATIONS</th>
<th>EDIT</th>
<th>DELETE</th>
</thead>
"; // start a table tag in the HTML
while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results
echo "<tr>
<th>" . $row['job_title'] . "</th>
<td>" . $row['status'] . "</td>
<td>" . $row['applications'] . "</td>
<td><a class='openModal' data-id='".$row['post_ID']."'>edit</a></td>
<td><a href='#'>delete</a></td>
</tr>";
}
echo "</table>"; //Close the table in HTML
?>
And here is my php inside the modal body
<?php
(LINE 121:) $queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
$resultEdit = mysql_query($queryEdit, $connection);
while($row1 = mysql_fetch_array($resultEdit)){
?>
<span>Name:</span> <?php echo $row1['job_title']; ?><br>
<span>loc:</span> <?php echo $row1['location']; ?><br>
<span>job type:</span> <?php echo $row1['job_type']; ?><br>
<span>description:</span> <?php echo $row1['job_desc']; ?><br>
<?php
}
?>
Here is the Execution error
Notice: Array to string conversion in C:xampphtdocstalent_space_phpemployerjobs_posted.php on line 121
PS. I just knew recently that the mysql_* will be depreciated, so im planning to finish this first and then convert into MYSQLI or PDO.
php html mysql
I need to call out a the other data from the database and display it through modal but i cant call out the ID from my html table.
Here's my html table and php for posting some of the data's :
<?php
$connection = mysql_connect('localhost', 'root', ''); //The Blank string is the password
mysql_select_db('ts_php');
$query = "SELECT * FROM job_posted"; //You don't need a ; like you do in SQL
$result = mysql_query($query);
echo "<table class='table'>
<thead>
<th>JOB</th>
<th>STATUS</th>
<th>APPLICATIONS</th>
<th>EDIT</th>
<th>DELETE</th>
</thead>
"; // start a table tag in the HTML
while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results
echo "<tr>
<th>" . $row['job_title'] . "</th>
<td>" . $row['status'] . "</td>
<td>" . $row['applications'] . "</td>
<td><a class='openModal' data-id='".$row['post_ID']."'>edit</a></td>
<td><a href='#'>delete</a></td>
</tr>";
}
echo "</table>"; //Close the table in HTML
?>
And here is my php inside the modal body
<?php
(LINE 121:) $queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
$resultEdit = mysql_query($queryEdit, $connection);
while($row1 = mysql_fetch_array($resultEdit)){
?>
<span>Name:</span> <?php echo $row1['job_title']; ?><br>
<span>loc:</span> <?php echo $row1['location']; ?><br>
<span>job type:</span> <?php echo $row1['job_type']; ?><br>
<span>description:</span> <?php echo $row1['job_desc']; ?><br>
<?php
}
?>
Here is the Execution error
Notice: Array to string conversion in C:xampphtdocstalent_space_phpemployerjobs_posted.php on line 121
PS. I just knew recently that the mysql_* will be depreciated, so im planning to finish this first and then convert into MYSQLI or PDO.
php html mysql
php html mysql
edited Nov 9 at 10:53
asked Nov 9 at 10:37
Armando Nb.
62
62
I just knew recently that the mysql_ will be depreciated* It is deprecated and removed in actual php versions
– Jens
Nov 9 at 10:42
2
What is the Problem with your code?
– Jens
Nov 9 at 10:42
But i still can use it... nvm that part. the problem was in the second PHP code, it dont display any result. I think it cant fetch the id from the 1st php code
– Armando Nb.
Nov 9 at 10:44
So is there any other way to fetch the row['ID'] and use it in WHERE id = 'row['ID']'?
– Armando Nb.
Nov 9 at 10:46
print out the Statement and see if it is as expected. Also check for SQL Errors after execution the statement
– Jens
Nov 9 at 10:46
|
show 10 more comments
I just knew recently that the mysql_ will be depreciated* It is deprecated and removed in actual php versions
– Jens
Nov 9 at 10:42
2
What is the Problem with your code?
– Jens
Nov 9 at 10:42
But i still can use it... nvm that part. the problem was in the second PHP code, it dont display any result. I think it cant fetch the id from the 1st php code
– Armando Nb.
Nov 9 at 10:44
So is there any other way to fetch the row['ID'] and use it in WHERE id = 'row['ID']'?
– Armando Nb.
Nov 9 at 10:46
print out the Statement and see if it is as expected. Also check for SQL Errors after execution the statement
– Jens
Nov 9 at 10:46
I just knew recently that the mysql_ will be depreciated* It is deprecated and removed in actual php versions
– Jens
Nov 9 at 10:42
I just knew recently that the mysql_ will be depreciated* It is deprecated and removed in actual php versions
– Jens
Nov 9 at 10:42
2
2
What is the Problem with your code?
– Jens
Nov 9 at 10:42
What is the Problem with your code?
– Jens
Nov 9 at 10:42
But i still can use it... nvm that part. the problem was in the second PHP code, it dont display any result. I think it cant fetch the id from the 1st php code
– Armando Nb.
Nov 9 at 10:44
But i still can use it... nvm that part. the problem was in the second PHP code, it dont display any result. I think it cant fetch the id from the 1st php code
– Armando Nb.
Nov 9 at 10:44
So is there any other way to fetch the row['ID'] and use it in WHERE id = 'row['ID']'?
– Armando Nb.
Nov 9 at 10:46
So is there any other way to fetch the row['ID'] and use it in WHERE id = 'row['ID']'?
– Armando Nb.
Nov 9 at 10:46
print out the Statement and see if it is as expected. Also check for SQL Errors after execution the statement
– Jens
Nov 9 at 10:46
print out the Statement and see if it is as expected. Also check for SQL Errors after execution the statement
– Jens
Nov 9 at 10:46
|
show 10 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
I did something similar recently.
The way i worked around it was this:
While generating my rows i added data
properties to my modal toggler (in my case a button). Just like you added data-id
. However i did this for every value that i need.
I simply used a jquery function to add my data into input fields inside of my modal.
Button table row generation:
<td><a href="#" class="editId" data-hidden="' . $product['id'] . '" data-name="' . $product['name'] .'"
data-short="' . $product['kuerzel'] . '"data-anr="' . $product['anumber'] . '"
data-comment="' . $product['comment'] . '" data-toggle="modal"
data-target="#editProductModal"><i class="far fa-edit"></i></a></td>
My Modal:
<div class="modal-body">
<input type="hidden" name="action2" value="edit">
<div class="form-row">
<div class="col-4">
<div class="form-group">
<input type="hidden" class="form-control" name="hidden" id="modal_hidden" value="">
</div>
<div class="form-group">
<label for="select_p" class="col-form label">Produkt:</label>
<input type="text" class="form-control" name="select" id="select_p" value="" required disabled>
</div>
<div class="form-group">
<label for="new_products_add_name" class="col-form label">New Name:</label>
<input type="text" class="form-control" name="new_name" id="new_products_add_name">
</div>
<div class="form-group">
<label for="new_products_add_short" class="col-form label">New Short:</label>
<input type="text" class="form-control" name="new_short" id="new_products_add_short">
</div>
<div class="form-group">
<label for="new_products_add_number" class="col-form label">New ProductNr:</label>
<input type="text" class="form-control" name="new_number" pattern="{3,11}" id="new_products_add_number">
</div>
<div class="form-group">
<label for="new_products_add_comment" class="col-form label">New Comment:</label>
<input type="text" class="form-control" name="new_comment" id="new_products_add_comment">
</div>
</div>
</div>
</div>
Function:
<script>
$(document).on("click",".editId",function() {
var hidden_value = $(this).data('hidden');
var name_value = $(this).data('name');
var short_value = $(this).data('short');
var anr_value = $(this).data('anr');
var comment_value = $(this).data('comment');
$('#modal_hidden').val(hidden_value);
$('#select_p').val(name_value);
$('#new_products_add_name').val(name_value);
$('#new_products_add_short').val(short_value);
$('#new_products_add_number').val(anr_value);
$('#new_products_add_comment').val(comment_value);
});
</script>
I hope this helps. This might not be the cleanest way of doing this, but it worked for me (and my table contains a fairly large number of rows).
add a comment |
up vote
0
down vote
First, I suggest you to not echo out html values.
Second, I would use pdo there are enough examples on the internet. A few tutorials should help you out.
As of your problem:
Change this:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
Into one of these:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = " + $row['post_ID'];
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = {$row['post_ID']} ";
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I did something similar recently.
The way i worked around it was this:
While generating my rows i added data
properties to my modal toggler (in my case a button). Just like you added data-id
. However i did this for every value that i need.
I simply used a jquery function to add my data into input fields inside of my modal.
Button table row generation:
<td><a href="#" class="editId" data-hidden="' . $product['id'] . '" data-name="' . $product['name'] .'"
data-short="' . $product['kuerzel'] . '"data-anr="' . $product['anumber'] . '"
data-comment="' . $product['comment'] . '" data-toggle="modal"
data-target="#editProductModal"><i class="far fa-edit"></i></a></td>
My Modal:
<div class="modal-body">
<input type="hidden" name="action2" value="edit">
<div class="form-row">
<div class="col-4">
<div class="form-group">
<input type="hidden" class="form-control" name="hidden" id="modal_hidden" value="">
</div>
<div class="form-group">
<label for="select_p" class="col-form label">Produkt:</label>
<input type="text" class="form-control" name="select" id="select_p" value="" required disabled>
</div>
<div class="form-group">
<label for="new_products_add_name" class="col-form label">New Name:</label>
<input type="text" class="form-control" name="new_name" id="new_products_add_name">
</div>
<div class="form-group">
<label for="new_products_add_short" class="col-form label">New Short:</label>
<input type="text" class="form-control" name="new_short" id="new_products_add_short">
</div>
<div class="form-group">
<label for="new_products_add_number" class="col-form label">New ProductNr:</label>
<input type="text" class="form-control" name="new_number" pattern="{3,11}" id="new_products_add_number">
</div>
<div class="form-group">
<label for="new_products_add_comment" class="col-form label">New Comment:</label>
<input type="text" class="form-control" name="new_comment" id="new_products_add_comment">
</div>
</div>
</div>
</div>
Function:
<script>
$(document).on("click",".editId",function() {
var hidden_value = $(this).data('hidden');
var name_value = $(this).data('name');
var short_value = $(this).data('short');
var anr_value = $(this).data('anr');
var comment_value = $(this).data('comment');
$('#modal_hidden').val(hidden_value);
$('#select_p').val(name_value);
$('#new_products_add_name').val(name_value);
$('#new_products_add_short').val(short_value);
$('#new_products_add_number').val(anr_value);
$('#new_products_add_comment').val(comment_value);
});
</script>
I hope this helps. This might not be the cleanest way of doing this, but it worked for me (and my table contains a fairly large number of rows).
add a comment |
up vote
1
down vote
I did something similar recently.
The way i worked around it was this:
While generating my rows i added data
properties to my modal toggler (in my case a button). Just like you added data-id
. However i did this for every value that i need.
I simply used a jquery function to add my data into input fields inside of my modal.
Button table row generation:
<td><a href="#" class="editId" data-hidden="' . $product['id'] . '" data-name="' . $product['name'] .'"
data-short="' . $product['kuerzel'] . '"data-anr="' . $product['anumber'] . '"
data-comment="' . $product['comment'] . '" data-toggle="modal"
data-target="#editProductModal"><i class="far fa-edit"></i></a></td>
My Modal:
<div class="modal-body">
<input type="hidden" name="action2" value="edit">
<div class="form-row">
<div class="col-4">
<div class="form-group">
<input type="hidden" class="form-control" name="hidden" id="modal_hidden" value="">
</div>
<div class="form-group">
<label for="select_p" class="col-form label">Produkt:</label>
<input type="text" class="form-control" name="select" id="select_p" value="" required disabled>
</div>
<div class="form-group">
<label for="new_products_add_name" class="col-form label">New Name:</label>
<input type="text" class="form-control" name="new_name" id="new_products_add_name">
</div>
<div class="form-group">
<label for="new_products_add_short" class="col-form label">New Short:</label>
<input type="text" class="form-control" name="new_short" id="new_products_add_short">
</div>
<div class="form-group">
<label for="new_products_add_number" class="col-form label">New ProductNr:</label>
<input type="text" class="form-control" name="new_number" pattern="{3,11}" id="new_products_add_number">
</div>
<div class="form-group">
<label for="new_products_add_comment" class="col-form label">New Comment:</label>
<input type="text" class="form-control" name="new_comment" id="new_products_add_comment">
</div>
</div>
</div>
</div>
Function:
<script>
$(document).on("click",".editId",function() {
var hidden_value = $(this).data('hidden');
var name_value = $(this).data('name');
var short_value = $(this).data('short');
var anr_value = $(this).data('anr');
var comment_value = $(this).data('comment');
$('#modal_hidden').val(hidden_value);
$('#select_p').val(name_value);
$('#new_products_add_name').val(name_value);
$('#new_products_add_short').val(short_value);
$('#new_products_add_number').val(anr_value);
$('#new_products_add_comment').val(comment_value);
});
</script>
I hope this helps. This might not be the cleanest way of doing this, but it worked for me (and my table contains a fairly large number of rows).
add a comment |
up vote
1
down vote
up vote
1
down vote
I did something similar recently.
The way i worked around it was this:
While generating my rows i added data
properties to my modal toggler (in my case a button). Just like you added data-id
. However i did this for every value that i need.
I simply used a jquery function to add my data into input fields inside of my modal.
Button table row generation:
<td><a href="#" class="editId" data-hidden="' . $product['id'] . '" data-name="' . $product['name'] .'"
data-short="' . $product['kuerzel'] . '"data-anr="' . $product['anumber'] . '"
data-comment="' . $product['comment'] . '" data-toggle="modal"
data-target="#editProductModal"><i class="far fa-edit"></i></a></td>
My Modal:
<div class="modal-body">
<input type="hidden" name="action2" value="edit">
<div class="form-row">
<div class="col-4">
<div class="form-group">
<input type="hidden" class="form-control" name="hidden" id="modal_hidden" value="">
</div>
<div class="form-group">
<label for="select_p" class="col-form label">Produkt:</label>
<input type="text" class="form-control" name="select" id="select_p" value="" required disabled>
</div>
<div class="form-group">
<label for="new_products_add_name" class="col-form label">New Name:</label>
<input type="text" class="form-control" name="new_name" id="new_products_add_name">
</div>
<div class="form-group">
<label for="new_products_add_short" class="col-form label">New Short:</label>
<input type="text" class="form-control" name="new_short" id="new_products_add_short">
</div>
<div class="form-group">
<label for="new_products_add_number" class="col-form label">New ProductNr:</label>
<input type="text" class="form-control" name="new_number" pattern="{3,11}" id="new_products_add_number">
</div>
<div class="form-group">
<label for="new_products_add_comment" class="col-form label">New Comment:</label>
<input type="text" class="form-control" name="new_comment" id="new_products_add_comment">
</div>
</div>
</div>
</div>
Function:
<script>
$(document).on("click",".editId",function() {
var hidden_value = $(this).data('hidden');
var name_value = $(this).data('name');
var short_value = $(this).data('short');
var anr_value = $(this).data('anr');
var comment_value = $(this).data('comment');
$('#modal_hidden').val(hidden_value);
$('#select_p').val(name_value);
$('#new_products_add_name').val(name_value);
$('#new_products_add_short').val(short_value);
$('#new_products_add_number').val(anr_value);
$('#new_products_add_comment').val(comment_value);
});
</script>
I hope this helps. This might not be the cleanest way of doing this, but it worked for me (and my table contains a fairly large number of rows).
I did something similar recently.
The way i worked around it was this:
While generating my rows i added data
properties to my modal toggler (in my case a button). Just like you added data-id
. However i did this for every value that i need.
I simply used a jquery function to add my data into input fields inside of my modal.
Button table row generation:
<td><a href="#" class="editId" data-hidden="' . $product['id'] . '" data-name="' . $product['name'] .'"
data-short="' . $product['kuerzel'] . '"data-anr="' . $product['anumber'] . '"
data-comment="' . $product['comment'] . '" data-toggle="modal"
data-target="#editProductModal"><i class="far fa-edit"></i></a></td>
My Modal:
<div class="modal-body">
<input type="hidden" name="action2" value="edit">
<div class="form-row">
<div class="col-4">
<div class="form-group">
<input type="hidden" class="form-control" name="hidden" id="modal_hidden" value="">
</div>
<div class="form-group">
<label for="select_p" class="col-form label">Produkt:</label>
<input type="text" class="form-control" name="select" id="select_p" value="" required disabled>
</div>
<div class="form-group">
<label for="new_products_add_name" class="col-form label">New Name:</label>
<input type="text" class="form-control" name="new_name" id="new_products_add_name">
</div>
<div class="form-group">
<label for="new_products_add_short" class="col-form label">New Short:</label>
<input type="text" class="form-control" name="new_short" id="new_products_add_short">
</div>
<div class="form-group">
<label for="new_products_add_number" class="col-form label">New ProductNr:</label>
<input type="text" class="form-control" name="new_number" pattern="{3,11}" id="new_products_add_number">
</div>
<div class="form-group">
<label for="new_products_add_comment" class="col-form label">New Comment:</label>
<input type="text" class="form-control" name="new_comment" id="new_products_add_comment">
</div>
</div>
</div>
</div>
Function:
<script>
$(document).on("click",".editId",function() {
var hidden_value = $(this).data('hidden');
var name_value = $(this).data('name');
var short_value = $(this).data('short');
var anr_value = $(this).data('anr');
var comment_value = $(this).data('comment');
$('#modal_hidden').val(hidden_value);
$('#select_p').val(name_value);
$('#new_products_add_name').val(name_value);
$('#new_products_add_short').val(short_value);
$('#new_products_add_number').val(anr_value);
$('#new_products_add_comment').val(comment_value);
});
</script>
I hope this helps. This might not be the cleanest way of doing this, but it worked for me (and my table contains a fairly large number of rows).
edited Nov 9 at 11:42
answered Nov 9 at 11:10
Matt.S
9313
9313
add a comment |
add a comment |
up vote
0
down vote
First, I suggest you to not echo out html values.
Second, I would use pdo there are enough examples on the internet. A few tutorials should help you out.
As of your problem:
Change this:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
Into one of these:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = " + $row['post_ID'];
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = {$row['post_ID']} ";
add a comment |
up vote
0
down vote
First, I suggest you to not echo out html values.
Second, I would use pdo there are enough examples on the internet. A few tutorials should help you out.
As of your problem:
Change this:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
Into one of these:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = " + $row['post_ID'];
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = {$row['post_ID']} ";
add a comment |
up vote
0
down vote
up vote
0
down vote
First, I suggest you to not echo out html values.
Second, I would use pdo there are enough examples on the internet. A few tutorials should help you out.
As of your problem:
Change this:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
Into one of these:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = " + $row['post_ID'];
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = {$row['post_ID']} ";
First, I suggest you to not echo out html values.
Second, I would use pdo there are enough examples on the internet. A few tutorials should help you out.
As of your problem:
Change this:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = '$row['post_ID']' ";
Into one of these:
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = " + $row['post_ID'];
$queryEdit = "SELECT * FROM job_posted WHERE post_ID = {$row['post_ID']} ";
answered Nov 9 at 11:03
Mo D Genesis
13010
13010
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224099%2fhow-to-call-out-a-data-using-an-id-from-the-displayed-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I just knew recently that the mysql_ will be depreciated* It is deprecated and removed in actual php versions
– Jens
Nov 9 at 10:42
2
What is the Problem with your code?
– Jens
Nov 9 at 10:42
But i still can use it... nvm that part. the problem was in the second PHP code, it dont display any result. I think it cant fetch the id from the 1st php code
– Armando Nb.
Nov 9 at 10:44
So is there any other way to fetch the row['ID'] and use it in WHERE id = 'row['ID']'?
– Armando Nb.
Nov 9 at 10:46
print out the Statement and see if it is as expected. Also check for SQL Errors after execution the statement
– Jens
Nov 9 at 10:46