10 months ago
thanks
Pinned Solution
10 months ago
The issue happens because the query in Node.js doesn’t specify the schema (railway.vendedores) and dni may be stored as a string, causing the request to hang or return nothing.
Use the full table path and cast dni as a string in your query:
const query = 'SELECT COUNT(*) as count FROM railway.vendedores WHERE dni = ?';
db.query(query, [String(req.params.dni)], (error, results) => {
if (error) return res.status(500).json({ error: 'Error al verificar DNI' });
console.log(results);
res.json({ available: results[0].count === 0 });
});2 Replies
10 months ago
Hey there! We've found the following might help you get unblocked faster:
- 📚 Railway vs. Vercel
- 📚 Deploy a Phoenix App with Distillery
- 🧵 cant' connect database to my CODIGLINATOR 3 project
If you find the answer from one of these, please let us know by solving the thread!
10 months ago
The issue happens because the query in Node.js doesn’t specify the schema (railway.vendedores) and dni may be stored as a string, causing the request to hang or return nothing.
Use the full table path and cast dni as a string in your query:
const query = 'SELECT COUNT(*) as count FROM railway.vendedores WHERE dni = ?';
db.query(query, [String(req.params.dni)], (error, results) => {
if (error) return res.status(500).json({ error: 'Error al verificar DNI' });
console.log(results);
res.json({ available: results[0].count === 0 });
});Status changed to Solved brody • 9 months ago