Skip to content

Tag: php

How to split text string in PHP (Song – Artist)

I have this bit of PHP ?> I want it to show on my page as: Song Artist How would I make the song appear in bold and what would I put in place of the ” – ” to make a line break instead? Answer Assuming you want to generate some HTML that can be picked up by a

Get average of average columns in mysql

I am having a table that stores ratings of a restaurant. As shown in the below image. I am trying to get the average of all these columns in which I am being successful but I also want an average of all these averages as a main average. I tried the below query but I am getting 3 as average

the session created in a page doesnt shares with other

when i create a session in php it still only in one page but doesnt get shared with others the login page code: my login code: and the logoff one: i have noticed that the browser saves a “phpsessid” cookie but it doesnt seems to share with other pages. i tried to print the session id with echo ses…

store data into pivot table laravel 8

i have manytomany relation ship between categroy and product category model product model the pivot table what should i do after this i did not undrestant how attach will work in pivot table and return it with the product as json response ? edit this is the schema i am working on i want to give each product i…

PHP MysqlI – How to Select 1 Row? (from select)

I am a bit stumped on how i should be able to Define 1 post ID, and only select from that row my query: my end goal is to get all from row 3 (only row 3), not get all rows. when i run the query above, i get every row from mysql. example: returns with all rows, what i