John Davidson

How do i append ".php" extension in href inside my while loop

0 comments
Message:


I have a while loop and its working properly, i am new to php and cannot figure out how to append the .php extention in the href inside php.
This is my loop:


while($get = mysqli_fetch_assoc($result))
{
echo"<tr>
<td><a href=". $get['title'] ." target=\"_blank\">".$get['title']."</a></td>
<td>".$get['info']."</td>
<td>".$get['author']."</td>
<td>".$get['price']."</td>
<td><a href='dwn.php?rn=$get[id]' target=\"_blank\">Download</a></td>
</tr>";
}

I want to add . php extention inside the href in the first tag , i thought it would be something like this :


<td><a href=" . $get['title'] . '.php'" target=\"_blank\">".$get['title']."</a></td>

But ofcourse this doest work, So please help me what should i do
Thanks in advance and Sorry for Bad English.



My Answer:
To append means to add something to the end of a list, document, or file. Here are some general steps on how to append:

1. For a list or array: Use the append() method to add an element to the end of the list. For example, in Python, you can use the append() method like this:
python
my_list = [1, 2, 3]
my_list.append(4)
print(my_list) # Output: [1, 2, 3, 4]


2. For a document or file: Open the file in append mode and write the content you want to add at the end of the file. For example, in Python, you can open a file in append mode like this:
python
with open('file.txt', 'a') as file:
file.write('This is the content to append\n')


3. For a string: Concatenate the new content to the existing string. For example, in Python, you can append a string like this:
python
my_string = 'Hello, '
my_string += 'world!'
print(my_string) # Output: Hello, world!


These are just some examples of how you can append content to different types of data structures. The specific method may vary depending on the programming language or tool you are using.

Rate this post

5 of 5 based on 2769 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us