Re-writing 3rd party addon to work with Phoenix
Posted: Wed Apr 13, 2022 10:40 am
Good morning Phoenix users.
I am currently modifying a 3rd party social media clone to fully work with Phoenix, currently works locally but not live, with that in mind I am creating this thread to ask questions where there is code that I am not sure how to convert to the Phoenix standard.
There are also some concerns over the fact the addon has it's own db connection that I would like to move away from, hence the code updates.
So here is my first issue, the below section of code puts a post into the db and returns the id to be used in later code.
This is my progress so far, it puts the code into the db but does not return the id
I know $this->con needs to be changed but not sure what to.
Any help would be appreciated.
I am currently modifying a 3rd party social media clone to fully work with Phoenix, currently works locally but not live, with that in mind I am creating this thread to ask questions where there is code that I am not sure how to convert to the Phoenix standard.
There are also some concerns over the fact the addon has it's own db connection that I would like to move away from, hence the code updates.
So here is my first issue, the below section of code puts a post into the db and returns the id to be used in later code.
Code: Select all
$query = mysqli_query($this->con, "INSERT INTO posts VALUES ('', '$body', '$added_by', '$user_to', '$date_added', 'no', 'no', '0', '$imageName')");
$returned_id = mysqli_insert_id($this->con);Code: Select all
$query = tep_db_query("INSERT INTO posts VALUES ('', '$body', '$added_by', '$user_to', '$date_added', 'no', 'no', '0', '$imageName')");
$returned_id = mysqli_insert_id($this->con);Any help would be appreciated.