johnnys Posted November 26, 2014 Share Posted November 26, 2014 Firstly I'm sure the answer is simple however due to my inexperience I am unable to figure it out! I am executing a simple query to retrieve all ISBN numbers within my db and display these in a table. In my db some of the ISBN numbers contain hyphens and some don't. I would like to display then in my table without hyphens. I'm grateful of any assistance and advice. I know I can remove all the hyphens from the db by executing a separate query however I'd like to strip them if possibly. My Code; $query = "SELECT * FROM book WHERE status != 'Archive' ORDER BY id"; while($row = mysqli_fetch_array($query)){ ?> <tr> <td><a href="itemView.php<?php echo '?isbn='.$row['isbn']; ?>" </a></td> <td>...</td> <td>...</td> <td>...</td> <td>...</td> </tr> <?php } ?> J Link to comment https://forums.phpfreaks.com/topic/292724-while-and-isbn-strip-hyphens/ Share on other sites More sharing options...
johnnys Posted November 26, 2014 Author Share Posted November 26, 2014 Ah figured it out <?php echo '?isbn='.str_replace ('-', '', $row['isbn']); ?> Link to comment https://forums.phpfreaks.com/topic/292724-while-and-isbn-strip-hyphens/#findComment-1497733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.